<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>华联商场后台管理系统</title>
    <link rel="stylesheet"  type="text/css"  href="/lib/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="/css/zyUpload.css">
    <link rel="stylesheet" href="/css/style.css">
    <link rel="stylesheet" href="/css/addgood.css">
    <link rel="stylesheet" href="/css/custom.css">
    <link rel="stylesheet" href="/css/iosOverlay.css">
    <link rel="stylesheet" href="/css/prettify.css">
    <script src="/lib/plug/modernizr-2.0.6.min.js"></script>
    <link rel="stylesheet" type="text/css" href="/css/layer.css">
    <link rel="stylesheet" href="/css/upimg.css"/>
</head>
<body >
<div class="panel panel-default">
    <div class="panel-heading " style="font-weight: 600;font-size: 14px"> 修改商品信息</div>
    <div class="panel-body">
        <form class="form-horizontal" action="{:url('admin/goods/updateSave')}" method="post" enctype="multipart/form-data">
            <div id="typewrapper"></div>
            <div class="form-group">
                <label  class="col-sm- control-label" style="font-size: 14px ;font-weight: 600 ;text-align: left;padding-left: 5%">修改商品分类 <span style="font-size: 12px
                ;color:#e92300">重新选择分类后需要重新填写商品规格
                </span></label>
            </div>
            <div class="form-group">
                <label  class="col-sm-2 control-label"></label>
                <div class="col-sm-10">
                    <div class="row">
                        <div class="col-sm-8">
                            <div class="col-sm-4 form-horizontal">
                                <select class="form-control" id="first">
                                    <option >请选择分类</option>
                                </select>
                            </div>
                            <div class="col-sm-4 form-horizontal">
                                <select class="form-control" id="section" ></select>
                            </div>
                            <div class="col-sm-4 form-horizontal">
                                <select class="form-control"  id="three" ></select>
                            </div>
                        </div>
                        <input type="text" name="categroy_id" hidden id="threeid">
                        <div class="col-sm-4">
                            <button type="button" class="btn btn-primary" id="bok">确定</button>
                            <a href="{:url('admin/category/insert')}" class="btn btn-link">添加商品分类</a>
                        </div>
                    </div>
                </div>
            </div>
            <hr style="margin-top: 30px">
            <!--通用信息 start-->
            <div class="form-group">
                <label  class="col-sm-6 control-label" style="font-size: 14px ;font-weight: 600 ;text-align: left;padding-left: 5%">修改商品信息：</label>
            </div>
            <div class="form-group">
                <div class="form-group">
                    <label class="col-sm-2 control-label"> 商品分类：</label>
                    <label class="control-label" id="goodclass" style="padding-left: 10px" name="shop_type" value="">{$cates}</label>
                    <input type="text" hidden id="shopId" name="shop_id" value="{$goods[0]['id']}">
                    <input type="text" hidden id="categroyId"  name="categroyId" value="{$goods[0]['categroy_id']}">
                </div>
            </div>
            <div class="form-group">
                <div class="form-group">
                    <label  class="col-sm-2 control-label"><i style="color: red">*</i>商品名：</label>
                    <div class="col-sm-4">
                        <input type="text" class="form-control" name="shop_name" value="{$goods[0]['shop_name']}" oninvalid="setCustomValidity('请您填写商品名')" oninput="setCustomValidity('')">
                    </div>
                </div>
            </div>
            <div class="form-group">
                <div class="form-group">
                    <label  class="col-sm-2 control-label" >商品类型：</label>
                    <div class="col-sm-4 checkbox" >
                        {if condition="$goods[0]['shop_type'] == 0"}
                        <label class="radio-inline" >
                            <input type="radio" name="shop_type"  checked  value="0" >普通商品
                        </label>
                        {else /}
                        <label class="radio-inline" >
                            <input type="radio" name="shop_type" id="inlineRadio2"   value="0" >普通商品
                        </label>
                        {/if}
                        <label class="radio-inline" >
                            <input type="radio" name="shop_type" id="inlineRadio3" disabled value="1">虚拟商品
                        </label>

                    </div>
                </div>
            </div>
            <div class="form-group">
                <div class="form-group">
                    <label  class="col-sm-2 control-label">供货商联系方式：</label>
                    <div class="col-sm-4">
                        <input type="text" class="form-control" name="supplier_iphone"  value="{$goods[0]['supplier_iphone']}" oninvalid="setCustomValidity('请您填写供货商联系方式')" oninput="setCustomValidity('')">
                    </div>
                </div>
                <div class="form-group">
                    <label  class="col-sm-2 control-label">联系人备注：</label>
                    <div class="col-sm-4">
                        <input type="text" class="form-control"  name="contact_remark"  value="{$goods[0]['contact_remark']}" oninvalid="setCustomValidity('请您填写联系人备注')" oninput="setCustomValidity('')">
                    </div>
                    <div class="col-lg-tip">
                        <span>【（例如：Alice(当当分店主管)  】</span>
                    </div>
                </div>
                <div class="form-group row">
                    <label  class="col-sm-2 control-label"><i style="color: red">*</i>商品售价(现价)：</label>
                    <div class="col-sm-4">
                        <input type="text" class="form-control newPrice" value="{$goods[0]['shop_end_money']}"   oninvalid="setCustomValidity('请您填写商品售价')" required oninput="setCustomValidity('')">
                        <input type="text"   hidden name="shop_end_money" value="{$goods[0]['shop_end_money']}" >
                    </div>
                    <label style="vertical-align: middle;color: red;display: none" class="tip">数据格式不正确，请填写数字格式</label>
                </div>
                <div class="form-group">
                    <label  class="col-sm-2 control-label">商品显示原价：</label>
                    <div class="col-sm-4">
                        <input type="text" class="form-control oldPrice" value="{$goods[0]['shop_start_money']}"   oninvalid="setCustomValidity('请您填写商品原价')"  oninput="setCustomValidity('')">
                        <input type="text" name="shop_start_money" hidden value="{$goods[0]['shop_start_money']}">
                    </div>
                    <div class="col-lg-tip">
                        <span>（不填写默认为现价）</span>
                        <label style="vertical-align: middle;color: red;display: none" class="tip">数据格式不正确，请填写数字格式</label>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label  class="col-sm-12 control-label" style="font-size: 14px ;font-weight: 600 ;text-align: left;padding-left: 5%"><i style="color: red">*</i>商品橱窗展示图：<span style="font-size: 12px
                ;color:#e92300"><i style="color: red">*</i>建议上传尺寸(368px*368px)
                </span></label>
            </div>
            <div class="form-group">
                <div class="form-group">
                    <label  class="col-sm-2 control-label"></label>
                    <div class="col-sm-le">
                        <div class="imgupload-box full">
                            <section class="img-section">
                                <div class="z_photo upimg-div clear">
                                    <section class="z_file fl" style="display: block;">
                                        <img src="{$image_path['image_path']}" class="add-img">
                                        <input type="text" name="id"  hidden value="{$image_path['id']}">
                                        <input type="text" hidden name="image"value="{$image_path['image_path']}"/>
                                        <input type="file" name="image_path" id="shiimg" class="filecc" value="" accept="image/jpg,image/jpeg,image/png,image/bmp">
                                    </section>
                                </div>
                                <p class="up-p up-p-center"><span class="up-span">上传图片</span></p>
                            </section>
                        </div>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <div class="form-group">
                    <label  class="col-sm-2 control-label">商品内部链接：</label>
                    <div class="col-sm-4">
                        <input type="text" class="form-control"  name="shop_link" value="{$goods[0]['shop_link']}" oninvalid="setCustomValidity('请您填写供货商')" oninput="setCustomValidity('')">
                    </div>
                </div>
            </div>

            <div class="form-group">
                <div class="form-group row">
                    <label  class="col-sm-2 control-label"><i style="color: red">*</i>商品运费：</label>
                    <div class="form-group">
                        {if condition="$goods[0]['freight'] == 0"}
                        <label class="radio-inline">
                            <input type="radio" name="freight" checked value="0" onclick="JM_wu(slshou)"> 免邮
                        </label>
                        <label class="radio-inline">
                            <input type="radio" name="freight"  value=""   onclick="JM_you(slshou)">按固定收费
                        </label>
                        <span id="slshou" class="sl_shou" style="display:none">
                            <input name="freight" type="text" class="form-control" style="display: inline-block;height:25px;width:80px;font-size: 10px " size='5' maxlength='2' placeholder="输入运费">
                        </span>
                        {else /}
                        <label class="radio-inline">
                            <input type="radio" name="freight"  value="0" onclick="JM_wu(slshou)"> 免邮
                        </label>
                        <label class="radio-inline">
                            <input type="radio" name="freight"  value=""  checked onclick="JM_you(slshou)">按固定收费
                        </label>
                        <span id="slshou" class="sl_shou">
                            <input name="freight" type="text" value="{$goods[0]['freight']}" class="form-control" style="display: inline-block;height:25px;width:80px;font-size: 10px " size='5' maxlength='2' placeholder="输入运费">
                        </span>
                        {/if}
                    </div>
                </div>
            </div>
            <div class="form-group">
                <div class="form-group row">
                    <label  class="col-sm-2 control-label"><i style="color: red">*</i>商品标识：<br>（最多选择3个）</label>
                    <div class="form-group" id="shopCheck">
                        <label class="radio-inline">
                            <input type="checkbox" name="shop_mark[] " class="shopMark"  checked value="华联自营" onclick="countChoices(this)" >华联自营
                        </label>
                        <label class="radio-inline">
                            <input type="checkbox" name="shop_mark[] " class="shopMark"   value="商家认证" onclick="countChoices(this)" >商家认证
                        </label>
                        <label class="radio-inline">
                            <input type="checkbox" name="shop_mark[] " class="shopMark"  value="正品保证" onclick="countChoices(this)">正品保证
                        </label>
                        <label class="radio-inline">
                            <input type="checkbox" name="shop_mark[] " class="shopMark"  value="7天无理由" onclick="countChoices(this)"> 7天无理由
                        </label>
                        <label class="radio-inline">
                            <input type="checkbox" name="shop_mark[] " class="shopMark"  value="快寄免邮" onclick="countChoices(this)"> 快寄免邮
                        </label>
                        <label class="radio-inline">
                            <input type="checkbox" name="shop_mark[] " class="shopMark"  value="顺丰速运" onclick="countChoices(this)"> 顺丰速运
                        </label>
                    </div>
                </div>
            </div>
            <div class=" form-group">
                <div class="form-group">
                    <label  class="col-sm-2 control-label" style="font-size: 14px;font-weight: bold"><i style="color: red">*</i>修改商品规格：</label>
                    <input type="text" name="stock_num" hidden />
                    <input type="text" name="spec" value="" hidden/>
                    <div class="col-sm-10" id="addType1">
                    </div>
                </div>
            </div>
            <!--通用信息  end-->
            <hr>
            <!--商品详情管理 start-->
            <div class="form-group">
                <label  class="col-sm-6 control-label" style="font-size: 14px ;font-weight: 600 ;text-align: left;padding-left: 5%">商品详情管理：</label>
            </div>
            <div class="form-group">
                <label  class="col-sm-12 control-label" style="font-size: 14px ;font-weight: 600 ;text-align: left;padding-left: 5%"><i style="color: red">*</i>上传商品banner图<i style="color: red;">建议上传（750px*750px）图片，大小不超过300kb，最少上传3张</i></label>
            </div>
            <div class="form-group row">
                <label  class="col-sm-2 control-label"></label>
                <div class="col-sm-3">
                    <div class="imgupload-box full">
                        <section class="img-section">
                            <div class="z_photo upimg-div clear">
                                <section class="z_file fl" style="display: block;">
                                    <img src="{$banners[0]['image_path']}" class="add-img">
                                    <input type="text" class="bannerid" name="id" hidden value="{$banners[0]['id']}">
                                    <!-- <input type="file" name="banner_path[]" id="file3" class="file3" value="" accept="image/jpg,image/jpeg,image/png,image/bmp">-->
                                    <input type="text"  class="banner0" name="banner[]" hidden value="{$banners[0]['id']};{$banners[0]['image_path']}"/>
                                    <input type="file" name="banner_path[]" id="banner1" class="file01" value="" accept="image/jpg,image/jpeg,image/png,image/bmp">
                                </section>
                            </div>
                        </section>
                    </div>
                </div>
                <div class="col-sm-3">
                    <div class="imgupload-box full">
                        <section class="img-section">
                            <div class="z_photo upimg-div clear">
                                <!--<section class="up-section fl"><span class="up-span"></span><img class="close-upimg" src="/images/delete_tu.png"><img class="up-img" src="{$banners[1]['image_path']}"><p class="img-name-p">大-470*450.jpg</p></section>-->
                                <section class="z_file fl" style="display: block;">
                                    <img src="{$banners[1]['image_path']}" class="add-img">
                                    <input type="text" class="bannerid" name="id" hidden value="{$banners[1]['id']}">
                                    <input type="text" class="banner1" name="banner[]" hidden value="{$banners[1]['id']};{$banners[1]['image_path']}"/>
                                    <!-- <input type="file" name="banner_path[]" id="file3" class="file3" value="" accept="image/jpg,image/jpeg,image/png,image/bmp">-->
                                    <input type="file" name="banner_path[]" id="banner2" class="file01" value="" accept="image/jpg,image/jpeg,image/png,image/bmp">
                                </section>
                            </div>
                        </section>
                    </div>
                </div>
                <div class="col-sm-3">
                    <div class="imgupload-box full">
                        <section class="img-section">
                            <div class="z_photo upimg-div clear">
                                <section class="z_file fl" style="display: block;">
                                    <img src="{$banners[2]['image_path']}" class="add-img">
                                    <input type="text" class="bannerid" name="id" hidden value="{$banners[2]['id']}">
                                    <input type="text" class="banner2" name="banner[]" hidden value="{$banners[2]['id']};{$banners[2]['image_path']}"/>
                                    <!-- <input type="file" name="banner_path[]" id="file3" class="file3" value="" accept="image/jpg,image/jpeg,image/png,image/bmp">-->
                                    <input type="file" name="banner_path[]" id="banner3" class="file01" value="" accept="image/jpg,image/jpeg,image/png,image/bmp">
                                </section>
                            </div>
                        </section>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label  class="col-sm-6 control-label" style="font-size: 14px ;font-weight: 600 ;text-align: left;padding-left: 5%"><i style="color: red">*</i>商品详情介绍：<i style="color: red;">建议上传（750px*450px图片）最少上传一张图片</i></label>
            </div>
            <div class="form-group row">
                <label  class="col-sm-2 control-label"></label>
                <div class="col-sm-8"  id="imgWrapper">
                    <div class="col-sm-le">
                        <div class="imgupload-box full">
                            <section class="img-section">
                                <div class="z_photo upimg-div clear">
<!--
                                    <section class="up-section fl"><span class="up-span"></span><img class="close-upimg" src="/images/delete_tu.png"><img class="up-img imgdesc" src="{$banners[1]['image_path']}" ><p class="img-name-p">大-470*450.jpg</p></section>
-->
                                    <section class="z_file fl imagedescwrapper" style="display: block;">

                                        <img src="/images/bg-tu.png" class="add-img">
                                        <input type="file"  id="shi01" class="file01 filemore" value="" accept="image/jpg,image/jpeg,image/png,image/bmp">
                                    </section>
                                </div>
                                <input type="text" class="desc1 det" name="detail[]" hidden value=""/>
                                <input type="text" class="descimgid"   hidden/>
                            </section>
                        </div>
                    </div>
                    <div class="col-sm-le">
                        <div class="imgupload-box full">
                            <section class="img-section">
                                <div class="z_photo upimg-div clear">
<!--
                                    <section class="up-section fl"><span class="up-span"></span><img class="close-upimg" src="/images/delete_tu.png"><img class="up-img imgdesc" src="{$banners[1]['image_path']}" ><p class="img-name-p">大-470*450.jpg</p></section>
-->
                                    <section class="z_file fl imagedescwrapper" style="display: block;">
                                        <img src="/images/bg-tu.png" class="add-img">
                                        <input type="file"  id="shi02" class="file01 filemore" value="" accept="image/jpg,image/jpeg,image/png,image/bmp">
                                    </section>
                                </div>
                                <input type="text" class="desc2 det" name="detail[]" hidden value=""/>
                                <input type="text" class="descimgid"  hidden/>
                            </section>
                        </div>
                    </div>
                    <div class="col-sm-le">
                        <div class="imgupload-box full">
                            <section class="img-section">
                                <div class="z_photo upimg-div clear">
<!--
                                    <section class="up-section fl"><span class="up-span"></span><img class="close-upimg" src="/images/delete_tu.png"><img class="up-img imgdesc" src="{$banners[1]['image_path']}" ><p class="img-name-p">大-470*450.jpg</p></section>
-->
                                    <section class="z_file fl imagedescwrapper" style="display: block;">
                                        <img src="/images/bg-tu.png" class="add-img">
                                        <input type="file"   id="shi03" class="file01 filemore" value="" accept="image/jpg,image/jpeg,image/png,image/bmp">
                                    </section>
                                </div>
                                <input type="text" class="desc3 det" name="detail[]" hidden value=""/>
                                <input type="text" class="descimgid"  hidden/>
                            </section>
                        </div>
                    </div>
                    <div class="col-sm-le">
                        <div class="imgupload-box full">
                            <section class="img-section">
                                <div class="z_photo upimg-div clear">
<!--
                                    <section class="up-section fl"><span class="up-span"></span><img class="close-upimg" src="/images/delete_tu.png"><img class="up-img imgdesc" src="{$banners[1]['image_path']}" ><p class="img-name-p">大-470*450.jpg</p></section>
-->
                                    <section class="z_file fl imagedescwrapper" style="display: block;">
                                        <img src="/images/bg-tu.png" class="add-img">
                                        <input type="file"   id="shi04" class="file01 filemore" value="" accept="image/jpg,image/jpeg,image/png,image/bmp">
                                    </section>
                                </div>
                                <input type="text" class="desc4 det" name="detail[]" hidden value=""/>

                                <input type="text" class="descimgid"   hidden/>
                            </section>
                        </div>
                    </div>
                    <div class="col-sm-le">
                        <div class="imgupload-box full">
                            <section class="img-section">
                                <div class="z_photo upimg-div clear">
<!--
                                    <section class="up-section fl"><span class="up-span"></span><img class="close-upimg" src="/images/delete_tu.png"><img class="up-img imgdesc" src="{$banners[1]['image_path']}" ><p class="img-name-p">大-470*450.jpg</p></section>
-->
                                    <section class="z_file fl imagedescwrapper" style="display: block;">
                                        <img src="/images/bg-tu.png" class="add-img">
                                        <input type="file"   id="shi05" class="file01 filemore" value="" accept="image/jpg,image/jpeg,image/png,image/bmp">
                                    </section>
                                </div>
                                <input type="text" class="desc5 det" name="detail[]" hidden value=""/>
                                <input type="text" class="descimgid"   hidden/>
                            </section>
                        </div>
                    </div>
                    <div class="col-sm-le">
                        <div class="imgupload-box full">
                            <section class="img-section">
                                <div class="z_photo upimg-div clear">
<!--
                                    <section class="up-section fl"><span class="up-span"></span><img class="close-upimg" src="/images/delete_tu.png"><img class="up-img imgdesc" src="{$banners[1]['image_path']}" ><p class="img-name-p">大-470*450.jpg</p></section>
-->
                                    <section class="z_file fl imagedescwrapper" style="display: block;">
                                        <img src="/images/bg-tu.png" class="add-img">
                                        <input type="file"   id="shi06" class="file01 filemore" value="" accept="image/jpg,image/jpeg,image/png,image/bmp">
                                    </section>
                                </div>
                                <input type="text" class="desc6 det" name="detail[]" hidden value=""/>
                                <input type="text" class="descimgid"   hidden/>
                            </section>
                        </div>
                    </div>
                    <div class="col-sm-le">
                        <div class="imgupload-box full">
                            <section class="img-section">
                                <div class="z_photo upimg-div clear">
<!--
                                    <section class="up-section fl"><span class="up-span"></span><img class="close-upimg" src="/images/delete_tu.png"><img class="up-img imgdesc" src="{$banners[1]['image_path']}" ><p class="img-name-p">大-470*450.jpg</p></section>
-->
                                    <section class="z_file fl imagedescwrapper" style="display: block;">
                                        <img src="/images/bg-tu.png" class="add-img">
                                        <input type="file"   id="shi07" class="file01 filemore" value="" accept="image/jpg,image/jpeg,image/png,image/bmp">
                                    </section>
                                </div>
                                <input type="text" class="desc7 det" name="detail[]" hidden value=""/>
                                <input type="text" class="descimgid"   hidden/>
                            </section>
                        </div>
                    </div>
                    <div class="col-sm-le">
                        <div class="imgupload-box full">
                            <section class="img-section">
                                <div class="z_photo upimg-div clear">
                                    <section class="z_file fl imagedescwrapper" style="display: block;">
                                        <img src="/images/bg-tu.png" class="add-img">
                                        <input type="file"   id="shi08" class="file01 filemore" value="" accept="image/jpg,image/jpeg,image/png,image/bmp">
                                    </section>
                                </div>
                                <input type="text" class="desc8 det" name="detail[]" hidden value=""/>
                                <input type="text" class="descimgid"   hidden/>
                            </section>
                        </div>
                    </div>
                    <div class="col-sm-le">
                        <div class="imgupload-box full">
                            <section class="img-section">
                                <div class="z_photo upimg-div clear">
<!--
                                    <section class="up-section fl"><span class="up-span"></span><img class="close-upimg" src="/images/delete_tu.png"><img class="up-img imgdesc" src="{$banners[1]['image_path']}" ><p class="img-name-p">大-470*450.jpg</p></section>
-->
                                    <section class="z_file fl imagedescwrapper" style="display: block;">
                                        <img src="/images/bg-tu.png" class="add-img">
                                        <input type="file"   id="shi09" class="file01 filemore" value="" accept="image/jpg,image/jpeg,image/png,image/bmp">
                                    </section>
                                </div>
                                <input type="text" class="desc9 det" name="detail[]" hidden value=""/>
                                <input type="text" class="descimgid"   hidden/>
                            </section>
                        </div>
                    </div>
                    <div class="col-sm-le">
                        <div class="imgupload-box full">
                            <section class="img-section">
                                <div class="z_photo upimg-div clear">
<!--
                                    <section class="up-section fl"><span class="up-span"></span><img class="close-upimg" src="/images/delete_tu.png"><img class="up-img imgdesc" src="{$banners[1]['image_path']}" ><p class="img-name-p">大-470*450.jpg</p></section>
-->
                                    <section class="z_file fl imagedescwrapper" style="display: block;">
                                        <img src="/images/bg-tu.png" class="add-img">
                                        <input type="file"   id="shi10" class="file01 filemore" value="" accept="image/jpg,image/jpeg,image/png,image/bmp">
                                    </section>
                                </div>
                                <input type="text" class="desc10 det" name="detail[]" hidden value=""/>
                                <input type="text" class="descimgid"   hidden/>
                            </section>
                        </div>
                    </div>
                    <div class="col-sm-le">
                        <div class="imgupload-box full">
                            <section class="img-section">
                                <div class="z_photo upimg-div clear">
                                    <!--
                                                                        <section class="up-section fl"><span class="up-span"></span><img class="close-upimg" src="/images/delete_tu.png"><img class="up-img imgdesc" src="{$banners[1]['image_path']}" ><p class="img-name-p">大-470*450.jpg</p></section>
                                    -->
                                    <section class="z_file fl imagedescwrapper" style="display: block;">
                                        <img src="/images/bg-tu.png" class="add-img">
                                        <input type="file"   id="shi11" class="file01 filemore" value="" accept="image/jpg,image/jpeg,image/png,image/bmp">
                                    </section>
                                </div>
                                <input type="text" class="desc11 det" name="detail[]" hidden value=""/>
                                <input type="text" class="descimgid"   hidden/>
                            </section>
                        </div>
                    </div>
                    <div class="col-sm-le">
                        <div class="imgupload-box full">
                            <section class="img-section">
                                <div class="z_photo upimg-div clear">
                                    <!--
                                                                        <section class="up-section fl"><span class="up-span"></span><img class="close-upimg" src="/images/delete_tu.png"><img class="up-img imgdesc" src="{$banners[1]['image_path']}" ><p class="img-name-p">大-470*450.jpg</p></section>
                                    -->
                                    <section class="z_file fl imagedescwrapper" style="display: block;">
                                        <img src="/images/bg-tu.png" class="add-img">
                                        <input type="file"   id="shi12" class="file01 filemore" value="" accept="image/jpg,image/jpeg,image/png,image/bmp">
                                    </section>
                                </div>
                                <input type="text" class="desc12 det" name="detail[]" hidden value=""/>
                                <input type="text" class="descimgid"   hidden/>
                            </section>
                        </div>
                    </div>
                    <div class="col-sm-le">
                        <div class="imgupload-box full">
                            <section class="img-section">
                                <div class="z_photo upimg-div clear">
                                    <!--
                                                                        <section class="up-section fl"><span class="up-span"></span><img class="close-upimg" src="/images/delete_tu.png"><img class="up-img imgdesc" src="{$banners[1]['image_path']}" ><p class="img-name-p">大-470*450.jpg</p></section>
                                    -->
                                    <section class="z_file fl imagedescwrapper" style="display: block;">
                                        <img src="/images/bg-tu.png" class="add-img">
                                        <input type="file"   id="shi13" class="file01 filemore" value="" accept="image/jpg,image/jpeg,image/png,image/bmp">
                                    </section>
                                </div>
                                <input type="text" class="desc13 det" name="detail[]" hidden value=""/>
                                <input type="text" class="descimgid"   hidden/>
                            </section>
                        </div>
                    </div>
                    <div class="col-sm-le">
                        <div class="imgupload-box full">
                            <section class="img-section">
                                <div class="z_photo upimg-div clear">
                                    <!--
                                                                        <section class="up-section fl"><span class="up-span"></span><img class="close-upimg" src="/images/delete_tu.png"><img class="up-img imgdesc" src="{$banners[1]['image_path']}" ><p class="img-name-p">大-470*450.jpg</p></section>
                                    -->
                                    <section class="z_file fl imagedescwrapper" style="display: block;">
                                        <img src="/images/bg-tu.png" class="add-img">
                                        <input type="file"   id="shi14" class="file01 filemore" value="" accept="image/jpg,image/jpeg,image/png,image/bmp">
                                    </section>
                                </div>
                                <input type="text" class="desc14 det" name="detail[]" hidden value=""/>
                                <input type="text" class="descimgid"   hidden/>
                            </section>
                        </div>
                    </div>
                    <div class="col-sm-le">
                        <div class="imgupload-box full">
                            <section class="img-section">
                                <div class="z_photo upimg-div clear">
                                    <!--
                                                                        <section class="up-section fl"><span class="up-span"></span><img class="close-upimg" src="/images/delete_tu.png"><img class="up-img imgdesc" src="{$banners[1]['image_path']}" ><p class="img-name-p">大-470*450.jpg</p></section>
                                    -->
                                    <section class="z_file fl imagedescwrapper" style="display: block;">
                                        <img src="/images/bg-tu.png" class="add-img">
                                        <input type="file"   id="shi15" class="file01 filemore" value="" accept="image/jpg,image/jpeg,image/png,image/bmp">
                                    </section>
                                </div>
                                <input type="text" class="desc15 det" name="detail[]" hidden value=""/>
                                <input type="text" class="descimgid"   hidden/>
                            </section>
                        </div>
                    </div>
                    <div class="col-sm-le">
                        <div class="imgupload-box full">
                            <section class="img-section">
                                <div class="z_photo upimg-div clear">
                                    <!--
                                                                        <section class="up-section fl"><span class="up-span"></span><img class="close-upimg" src="/images/delete_tu.png"><img class="up-img imgdesc" src="{$banners[1]['image_path']}" ><p class="img-name-p">大-470*450.jpg</p></section>
                                    -->
                                    <section class="z_file fl imagedescwrapper" style="display: block;">
                                        <img src="/images/bg-tu.png" class="add-img">
                                        <input type="file"   id="shi16" class="file01 filemore" value="" accept="image/jpg,image/jpeg,image/png,image/bmp">
                                    </section>
                                </div>
                                <input type="text" class="desc16 det" name="detail[]" hidden value=""/>
                                <input type="text" class="descimgid"   hidden/>
                            </section>
                        </div>
                    </div>
                    <div class="col-sm-le">
                        <div class="imgupload-box full">
                            <section class="img-section">
                                <div class="z_photo upimg-div clear">
                                    <!--
                                                                        <section class="up-section fl"><span class="up-span"></span><img class="close-upimg" src="/images/delete_tu.png"><img class="up-img imgdesc" src="{$banners[1]['image_path']}" ><p class="img-name-p">大-470*450.jpg</p></section>
                                    -->
                                    <section class="z_file fl imagedescwrapper" style="display: block;">
                                        <img src="/images/bg-tu.png" class="add-img">
                                        <input type="file"   id="shi17" class="file01 filemore" value="" accept="image/jpg,image/jpeg,image/png,image/bmp">
                                    </section>
                                </div>
                                <input type="text" class="desc17 det" name="detail[]" hidden value=""/>
                                <input type="text" class="descimgid"   hidden/>
                            </section>
                        </div>
                    </div>
                    <div class="col-sm-le">
                        <div class="imgupload-box full">
                            <section class="img-section">
                                <div class="z_photo upimg-div clear">
                                    <!--
                                                                        <section class="up-section fl"><span class="up-span"></span><img class="close-upimg" src="/images/delete_tu.png"><img class="up-img imgdesc" src="{$banners[1]['image_path']}" ><p class="img-name-p">大-470*450.jpg</p></section>
                                    -->
                                    <section class="z_file fl imagedescwrapper" style="display: block;">
                                        <img src="/images/bg-tu.png" class="add-img">
                                        <input type="file"   id="shi18" class="file01 filemore" value="" accept="image/jpg,image/jpeg,image/png,image/bmp">
                                    </section>
                                </div>
                                <input type="text" class="desc18 det" name="detail[]" hidden value=""/>
                                <input type="text" class="descimgid"   hidden/>
                            </section>
                        </div>
                    </div>
                    <div class="col-sm-le">
                        <div class="imgupload-box full">
                            <section class="img-section">
                                <div class="z_photo upimg-div clear">
                                    <!--
                                                                        <section class="up-section fl"><span class="up-span"></span><img class="close-upimg" src="/images/delete_tu.png"><img class="up-img imgdesc" src="{$banners[1]['image_path']}" ><p class="img-name-p">大-470*450.jpg</p></section>
                                    -->
                                    <section class="z_file fl imagedescwrapper" style="display: block;">
                                        <img src="/images/bg-tu.png" class="add-img">
                                        <input type="file"   id="shi19" class="file01 filemore" value="" accept="image/jpg,image/jpeg,image/png,image/bmp">
                                    </section>
                                </div>
                                <input type="text" class="desc19 det" name="detail[]" hidden value=""/>
                                <input type="text" class="descimgid"   hidden/>
                            </section>
                        </div>
                    </div>
                    <div class="col-sm-le">
                        <div class="imgupload-box full">
                            <section class="img-section">
                                <div class="z_photo upimg-div clear">
                                    <!--
                                                                        <section class="up-section fl"><span class="up-span"></span><img class="close-upimg" src="/images/delete_tu.png"><img class="up-img imgdesc" src="{$banners[1]['image_path']}" ><p class="img-name-p">大-470*450.jpg</p></section>
                                    -->
                                    <section class="z_file fl imagedescwrapper" style="display: block;">
                                        <img src="/images/bg-tu.png" class="add-img">
                                        <input type="file"   id="shi20" class="file01 filemore" value="" accept="image/jpg,image/jpeg,image/png,image/bmp">
                                    </section>
                                </div>
                                <input type="text" class="desc20 det" name="detail[]" hidden value=""/>
                                <input type="text" class="descimgid"   hidden/>
                            </section>
                        </div>
                    </div>
                </div>
            </div>
            <!--商品详情管理 end-->
            <div class="form-group row" style="margin-top: 30px">
                <div class="form-group" style="text-align: center">
                    <button type="submit" class="btn btn-info" id="submit">完成</button>
                    <button type="reset" class="btn btn-success" id="reset">重置</button>
                </div>
            </div>
        </form>
    </div>
</div>
<!--<!-上传删除确认->-->
<aside class="mask works-mask" style="display: none;">
    <div class="mask-content">
        <p class="del-p ">您确定要删除图片吗？</p>
        <p class="check-p"><span class="del-com wsdel-ok">确定</span><span class="wsdel-no">取消</span></p>
    </div>
</aside>

<script src="/lib/jquery/jquery.min.js"></script>
<script src="/lib/bootstrap/js/bootstrap.min.js"></script>
<script src="/js/iosOverlay.js"></script>
<script src="/lib/plug/spin.min.js"></script>
<script src="/lib/plug/prettify.js"></script>
<script src="/js/method.js"></script>
<!--<script src="/js/upload1.js"></script>-->

<script src="/js/updategood.js"></script>
<script type="text/javascript">
    var stock_num=0;
    /*获取商品详情图片*/
    $.ajax({
        url:"{:url('/admin/goods/detailPicture')}",
        data:{"shop_id":$("#shopId").val()},
        type:"post",
        dataType:"json",
        success:function(val){
            console.log(val);
            for(var i=0;i<10;i++){
                if(val[i]){
                    var ele=`<section class="up-section fl"><span class="up-span"></span><img class="close-upimg" src="/images/delete_tu.png"><img class="up-img imgdesc" src=${val[i].image_path} ><p class="img-name-p">大-470*450.jpg</p></section>`;
                    $($(".imagedescwrapper").get(i)).before(ele).css("display","none");
                    $(".descimgid").get(i).value=val[i].id;
                }
/*
                val[i]?$($(".imgdesc").get(i)).attr("src",val[i].image_path):$($(".imgdesc").get(i)).attr("src",'/images/bg-tu.png')
*/
                var idpath=val[i]?`${val[i].id};${val[i].image_path}`:"";
                val[i]?$($(".det").get(i)).val(idpath):$($(".det").get(i)).val("")
            }
        }
    });
    /*获取商品标识*/
    $.ajax({
        url:"{:url('/admin/goods/shopMark')}",
        data:{"shop_id":$("#shopId").val()},
        type:"post",
        dataType:"json",
        success:function(val){
            val=val.shop_mark.split(",");
            console.log(val);
            var markary=["华联自营","商家认证","正品保证","7天无理由"," 快寄免邮","顺丰速运"];
            for(var i=0;i<markary.length;i++){
                var cur=markary[i];
                for(var j=0;j<=val.length;j++){
                    val[j]==cur?$(".shopMark").get(i).checked=true:null;
                }
            }
        }
    });
    function JM_wu(ob) {
        ob.style.display = "none";
        $("input[name=freight]").val("0")
    }
    function JM_you(ob) {
        ob.style.display = "";
    }


    /*去重*/
    Array.prototype.unique1 = function(){
        var res = [this[0]];
        for(var i = 1; i < this.length; i++){
            var repeat = false;
            for(var j = 0; j < res.length; j++){
                if(this[i] == res[j]){
                    repeat = true;
                    break;
                }
            }
            if(!repeat){
                res.push(this[i]);
            }
        }
        return res;
    };
    /*填充规格*/
    window.onload=function () {
        var shopId=$("#shopId").val();
        var threeId=$("#categroyId").val();
        $.ajax({
            url:"{:url('/admin/goods/getGoodsSpec')}",
            data:{"type":3,"categroy_id":threeId,"shop_id":shopId},
            type:"post",
            async:false,
            dataType:"json",
            success:function (res) {
                console.log(res);
                if(res){
                    var cateSpec = res.cate;
                    var shopSpec = res.shop;
                    var typeidary=[];
                    var typeval=[];
                    /*有两种规格的情况*/
                    if(cateSpec.length==2){
                        for(let i=0;i<shopSpec.length;i++){
                            let typevalcur=shopSpec[i].id+"|&|"+shopSpec[i].spec_one_name+"|&|"+shopSpec[i].spec_two_name+"|&|"+shopSpec[i].stock_num+"|&|"+shopSpec[i].warning_num
                            typeval.push(typevalcur)
                            typeidary.push(shopSpec[i].id);
                        }
                        console.log(typeidary)
                        $("input[name=spec]").val(typeval);
                        console.log($("input[name=spec]").val())
                        stock_num=0;
                        var typenameay=[];
                        for(let i=0;i<cateSpec.length;i++){
                            var cur=cateSpec[i].spec_name;
                            typenameay.push(cur);
                        }
                        var spec_one_name=[];
                        var spec_two_name=[];
                        var shoptypeid=[];
                        var tbodystr="";
                        for(let j=0;j<shopSpec.length;j++){
                            spec_one_name.push(shopSpec[j].spec_one_name);
                            spec_two_name.push(shopSpec[j].spec_two_name);
                            stock_num+=Number(shopSpec[j].stock_num);
                            shoptypeid.push(shopSpec[j].id);
                            tbodystr+=`<tr style="text-align: center">
                                                <td class="col-sm-2">${shopSpec[j].spec_one_name}</td>
                                                <td class="col-sm-2">${shopSpec[j].spec_two_name}</td>
                                                <td class="col-sm-2"><input type="text" class="inputcount" value=${shopSpec[j].stock_num}></td>
                                                <td class="col-sm-2"><input type="text" class="inputwramming" value=${shopSpec[j].warning_num}></td>
                                            </tr>`;
                        }
                        $("input[name=stock_num]").val(stock_num);
                        console.log(spec_one_name,spec_two_name);
                        spec_one_name=spec_one_name.unique1();
                        spec_two_name=spec_two_name.unique1();
                        console.log(spec_one_name,spec_two_name);
                        var str=`<a class="btn btn-info" role="button" data-toggle="collapse" id="editType" href="#collapseExample" aria-expanded="false" aria-controls="collapseExample">修改商品属性</a>
                    <div class="collapse" id="collapseExample">
                        <div class="well" style="background-color: #fff;" >
                                <div class="row" style="text-align: center" id="color">
                                    <label class="col-sm-2" style="font-weight: bold">${typenameay[0]}:</label>
                                    <div class="col-sm-2">
                                        <input type="checkbox" class="colorcheck" ${spec_one_name[0]?"checked":""}><input class="colorinput" type="text" value="${spec_one_name[0]?spec_one_name[0]:""}" style="width: 50px; border: 1px solid #CCCCCC" ${spec_one_name[0]?"":"disabled"}>
                                    </div>
                                    <div class="col-sm-2">
                                        <input type="checkbox" class="colorcheck" ${spec_one_name[1]?"checked":""}><input class="colorinput" type="text" value="${spec_one_name[1]?spec_one_name[1]:""}" style="width: 50px;border: 1px solid #CCCCCC" ${spec_one_name[1]?"":"disabled"}>
                                    </div>
                                    <div class="col-sm-2">
                                        <input type="checkbox" class="colorcheck" ${spec_one_name[2]?"checked":""}><input class="colorinput" type="text" value='${spec_one_name[2]?spec_one_name[2]:""}' style="width: 50px;border: 1px solid #CCCCCC" ${spec_one_name[2]?"":"disabled"} >
                                    </div>
                                     <div class="col-sm-2">
                                        <input type="checkbox" class="colorcheck" ${spec_one_name[3]?"checked":""}><input  class="colorinput" type="text" value='${spec_one_name[3]?spec_one_name[3]:""}' style="width: 50px; border: 1px solid #CCCCCC" ${spec_one_name[3]?"":"disabled"} >
                                    </div>
                                </div>
                                <div class="row" style="text-align: center">
                                    <label class="col-sm-2"></label>

                                    <div class="col-sm-2">
                                        <input type="checkbox" class="colorcheck" ${spec_one_name[4]?"checked":""}><input class="colorinput" type="text" value='${spec_one_name[4]?spec_one_name[4]:""}' style="width: 50px;border: 1px solid #CCCCCC" ${spec_one_name[4]?"":"disabled"}>
                                    </div>
                                    <div class="col-sm-2">
                                        <input type="checkbox" class="colorcheck" ${spec_one_name[5]?"checked":""}><input class="colorinput" type="text" value='${spec_one_name[5]?spec_one_name[5]:""}' style="width: 50px;border: 1px solid #CCCCCC" ${spec_one_name[5]?"":"disabled"}>
                                    </div>
                                    <div class="col-sm-2">
                                        <input type="checkbox" class="colorcheck" ${spec_one_name[6]?"checked":""}><input class="colorinput" type="text" value='${spec_one_name[6]?spec_one_name[6]:""}' style="width: 50px;border: 1px solid #CCCCCC" ${spec_one_name[6]?"":"disabled"}>
                                    </div>
                                    <div class="col-sm-2">
                                        <input type="checkbox" class="colorcheck" ${spec_one_name[7]?"checked":""}><input class="colorinput" type="text" value='${spec_one_name[7]?spec_one_name[7]:""}' style="width: 50px;border: 1px solid #CCCCCC" ${spec_one_name[7]?"":"disabled"}>
                                    </div>
                                </div>
                                <div class="row" style="text-align: center">
                                    <label class="col-sm-2"></label>
                                    <div class="col-sm-2">
                                        <input type="checkbox" class="colorcheck" ${spec_one_name[8]?"checked":""}><input class="colorinput" type="text" value='${spec_one_name[8]?spec_one_name[8]:""}' style="width: 50px;border: 1px solid #CCCCCC" ${spec_one_name[8]?"":"disabled"}>
                                    </div>
                                    <div class="col-sm-2">
                                        <input type="checkbox" class="colorcheck" ${spec_one_name[9]?"checked":""}><input class="colorinput" type="text" value='${spec_one_name[9]?spec_one_name[9]:""}' style="width: 50px;border: 1px solid #CCCCCC" ${spec_one_name[9]?"":"disabled"}>
                                    </div>
                                    <div class="col-sm-2">
                                        <input type="checkbox" class="colorcheck" ${spec_one_name[10]?"checked":""}><input class="colorinput" type="text" value='${spec_one_name[10]?spec_one_name[10]:""}' style="width: 50px;border: 1px solid #CCCCCC" ${spec_one_name[10]?"":"disabled"}>
                                    </div>
                                    <div class="col-sm-2">
                                        <input type="checkbox" class="colorcheck" ${spec_one_name[11]?"checked":""}><input class="colorinput" type="text" value='${spec_one_name[11]?spec_one_name[11]:""}' style="width: 50px;border: 1px solid #CCCCCC" ${spec_one_name[11]?"":"disabled"}>
                                    </div>
                                </div>
                                <div class="row" style="text-align: center;margin-top: 20px">
                                    <label class="col-sm-2" style="font-weight: bold">${typenameay[1]}:</label>
                                    <div class="col-sm-2">
                                        <input type="checkbox" class="sizecheck" ${spec_two_name[0]?"checked":""}><input  class="sizeinput" type="text" value="${spec_two_name[0]?spec_two_name[0]:""}" style="width: 50px; border: 1px solid #CCCCCC" ${spec_two_name[0]?"":"disabled"} >
                                    </div>
                                    <div class="col-sm-2">
                                        <input type="checkbox" class="sizecheck" ${spec_two_name[1]?"checked":""}><input class="sizeinput" type="text" value="${spec_two_name[1]?spec_two_name[1]:""}" style="width: 50px;border: 1px solid #CCCCCC" ${spec_two_name[1]?"":"disabled"}>
                                    </div>
                                    <div class="col-sm-2">
                                        <input type="checkbox" class="sizecheck" ${spec_two_name[2]?"checked":""}><input class="sizeinput" type="text" value="${spec_two_name[2]?spec_two_name[2]:""}" style="width: 50px;border: 1px solid #CCCCCC" ${spec_two_name[2]?"":"disabled"}>
                                    </div>
                                     <div class="col-sm-2">
                                        <input type="checkbox" class="sizecheck" ${spec_two_name[3]?"checked":""}><input  class="sizeinput" type="text" value="${spec_two_name[3]?spec_two_name[3]:""}" style="width: 50px; border: 1px solid #CCCCCC" ${spec_two_name[3]?"":"disabled"} >
                                    </div>
                                </div>
                                <div class="row" style="text-align: center">
                                    <label class="col-sm-2"></label>

                                    <div class="col-sm-2">
                                        <input type="checkbox" class="sizecheck" ${spec_two_name[4]?"checked":""}><input class="sizeinput" type="text" value="${spec_two_name[4]?spec_two_name[4]:""}" style="width: 50px;border: 1px solid #CCCCCC" ${spec_two_name[4]?"":"disabled"}>
                                    </div>
                                    <div class="col-sm-2">
                                        <input type="checkbox" class="sizecheck" ${spec_two_name[5]?"checked":""}><input class="sizeinput" type="text" value="${spec_two_name[5]?spec_two_name[5]:""}" style="width: 50px;border: 1px solid #CCCCCC" ${spec_two_name[5]?"":"disabled"}>
                                    </div>
                                    <div class="col-sm-2">
                                        <input type="checkbox" class="sizecheck" ${spec_two_name[6]?"checked":""}><input class="sizeinput" type="text" value="${spec_two_name[6]?spec_two_name[6]:""}" style="width: 50px;border: 1px solid #CCCCCC" ${spec_two_name[6]?"":"disabled"}>
                                    </div>
                                    <div class="col-sm-2">
                                        <input type="checkbox" class="sizecheck" ${spec_two_name[7]?"checked":""}><input class="sizeinput" type="text" value="${spec_two_name[7]?spec_two_name[7]:""}" style="width: 50px;border: 1px solid #CCCCCC" ${spec_two_name[7]?"":"disabled"}>
                                    </div>
                                </div>
                                   <div class="row" style="text-align: center">
                                    <label class="col-sm-2"></label>

                                    <div class="col-sm-2">
                                        <input type="checkbox" class="sizecheck" ${spec_two_name[8]?"checked":""}><input class="sizeinput" type="text" value="${spec_two_name[8]?spec_two_name[8]:""}" style="width: 50px;border: 1px solid #CCCCCC" ${spec_two_name[8]?"":"disabled"}>
                                    </div>
                                    <div class="col-sm-2">
                                        <input type="checkbox" class="sizecheck" ${spec_two_name[9]?"checked":""}><input class="sizeinput" type="text" value="${spec_two_name[9]?spec_two_name[9]:""}" style="width: 50px;border: 1px solid #CCCCCC" ${spec_two_name[9]?"":"disabled"}>
                                    </div>
                                    <div class="col-sm-2">
                                        <input type="checkbox" class="sizecheck" ${spec_two_name[10]?"checked":""}><input class="sizeinput" type="text" value="${spec_two_name[10]?spec_two_name[10]:""}" style="width: 50px;border: 1px solid #CCCCCC" ${spec_two_name[10]?"":"disabled"}>
                                    </div>
                                    <div class="col-sm-2">
                                        <input type="checkbox" class="sizecheck" ${spec_two_name[11]?"checked":""}><input class="sizeinput" type="text" value="${spec_two_name[11]?spec_two_name[11]:""}" style="width: 50px;border: 1px solid #CCCCCC" ${spec_two_name[11]?"":"disabled"}>
                                    </div>
                                </div>
                                <div class="row" style="text-align: center;margin-top: 20px">
                                    <button class="btn btn-default" type="button" id="addtype">确定生成</button>
                                </div>
                                <div class="form-inline pull-right" style="margin: 30px 0" >
  <div class="form-group">
    <label for="exampleInputEmail2">批量设置:</label>
    <input type="text" class="form-control" style="width:120px" id="stock" placeholder="库存">
    <input type="text" class="form-control" style="width:120px" id="wraningStock" placeholder="预警库存"><button class="btn btn-default" type="button" id="PLSZbtn">确定</button>
  </div>
</div>
                                <div class="row" style="margin-top: 20px">
                                    <table class="goodtype-wrapper table table-striped"style="width: 100%">
                                        <thead  style="background-color: #eeeeee;">
                                            <tr style="text-align: center;height: 30px">
                                                <td class="col-sm-2">${typenameay[0]}</td>
                                                <td class="col-sm-2">${typenameay[1]}</td>
                                                <td class="col-sm-2"><i style="color: red">*</i>库存</td>
                                                <td class="col-sm-2">警戒库存</td>
                                            </tr>
                                        </thead>
                                        <tbody id="tbody">
                                        </tbody>
                                    </table>
                                </div>
                                <div class="row" style="text-align: center">
                                    <button type="button" class="btn btn-success" id="typeOk">确定</button>
                                </div>
                        </div>
                    </div>`;
                        $("#addType1").html(str);
                        $("#tbody").html(tbodystr);
                        $("#PLSZbtn").click(function(){
                            var stockval=Number($("#stock").val());
                            var wraningStockval=$("#wraningStock").val();
                            if(stockval ){
                                if(!isNaN(stockval)){
                                    $(".inputcount").val(stockval);
                                }else{
                                    iosOverlay({
                                        text: "库存必须为数字!",
                                        duration: 2e3,
                                        icon: "../../images/cross.png"
                                    });
                                }
                            }
                            if(wraningStockval){
                                if(!isNaN(wraningStockval)){
                                    $(".inputwramming").val(wraningStockval);
                                }else{
                                    iosOverlay({
                                        text: "预警库存必须为数字!",
                                        duration: 2e3,
                                        icon: "../../images/cross.png"
                                    });}
                            }
                        });
                        $("#editType").trigger("click");
                        $(".colorcheck").each(function (index,item) {
                            $(item).click(
                                    function () {
                                        var index=$(this).index();
                                        $(".colorcheck").each(function (index, item) {
                                                    if($(this).is(':checked')){
                                                        // alert(index)
                                                        $($(".colorinput").get(index)).attr("disabled",false)
                                                    }else {
                                                        $($(".colorinput").get(index)).attr("disabled",true)
                                                    }
                                                }
                                        )
                                    });
                        });
                        /*商品规格 尺码选择*/
                        $(".sizecheck").each(function (index,item){
                            $(item).click(
                                    function () {
                                        var index=$(this).index();
                                        $(".sizecheck").each(function (index, item) {
                                                    if($(this).is(':checked')){
                                                        // alert(index)
                                                        $($(".sizeinput").get(index)).attr("disabled",false);
                                                    }else {

                                                        $($(".sizeinput").get(index)).attr("disabled",true)
                                                    }
                                                }
                                        )
                                    });
                        });
                        $(document).on("click","#addtype",function (){
                            color=[];
                            size=[];
                            var str='';
                            var bok=true;
                            $(".colorcheck").each(function (index, item) {
                                if(item.checked){
                                    var val=$($(".colorinput").get(index)).val();

                                    if(val){
                                        color.push(val)
                                    }else{
                                        bok=false;
                                        return;
                                    }
                                }
                            });
                            $(".sizecheck").each(function (index, item) {
                                if(item.checked){
                                    var val=$($(".sizeinput").get(index)).val();
                                    if(val){
                                        size.push(val)
                                    }else{
                                        bok=false;
                                        return;
                                    }
                                }
                            });

                            if(bok){
                                for (var i=0;i<color.length;i++){
                                    var curcolor=color[i];
                                    for(var j=0;j<size.length;j++){
                                        var cursize=size[j];
                                        str+=`<tr style="text-align: center">
                                                <td class="col-sm-2">${curcolor}</td>
                                                <td class="col-sm-2">${cursize}</td>
                                                <td class="col-sm-2"><input type="text" class="inputcount" value="0"></td>
                                                <td class="col-sm-2"><input type="text" class="inputwramming" value="10"></td>
                                            </tr>`
                                    }
                                    var arykucun=[];
                                }
                                $("#tbody").html(str);
                                /*批量设置库存*/

                                /*点击确定生成数据*/


                            }else{
                                iosOverlay({
                                    text: "请填写完整信息!",
                                    duration: 2e3,
                                    icon: "../../images/cross.png"
                                });
                            }


                        });
                        $(document).on("click","#typeOk",function (){
                            stock_num=0;
                            var trcount=$("tbody tr").length;
                            var datatye=[];
                            if(trcount){
                                stock_num=0;
                                console.log(typeidary);
                                for(var  i =0;i<trcount;i++){
                                    var str="";
                                    stock_num+=Number($($($("tbody tr").get(i)).children("td")[2]).children().val());
                                    str=$($($("tbody tr").get(i)).children("td")[0]).html()+'|&|'+$($($("tbody tr").get(i)).children("td")[1]).html()+'|&|'+$($($("tbody tr").get(i)).children("td")[2]).children().val()+'|&|'+$($($("tbody tr").get(i)).children("td")[3]).children().val();
                                    datatye.push(str);
                                }
                                $("input[name=spec]").val(datatye);
                                console.log($("input[name=spec]").val());
                                $("input[name=stock_num]").val(stock_num);
                                console.log(stock_num);
                                $(this).html("数据已生成").removeClass("btn-info").addClass("btn-success");
                            }else{
                                iosOverlay({
                                    text: "请先选择规格!",
                                    duration: 2e3,
                                    icon: "../../images/cross.png"
                                });
                            }

                        });
                      /*  $(document).on("click","#typeOk",function () {
                            stock_num=0
                            var trcount=$("tbody tr").length;
                            var datatye=[];
                            if(trcount){
                                for(var  i =0;i<trcount;i++){
                                    var str="";
                                    stock_num+=Number($($($("tbody tr").get(i)).children("td")[2]).children().val());
                                    str=$($($("tbody tr").get(i)).children("td")[0]).html()+'|&|'+$($($("tbody tr").get(i)).children("td")[1]).html()+'|&|'+$($($("tbody tr").get(i)).children("td")[2]).children().val()+'|&|'+$($($("tbody tr").get(i)).children("td")[3]).children().val();
                                    datatye.push(str);
                                }
                                $("input[name=spec]").val(datatye);
                                console.log($("input[name=spec]").val())
                                $("input[name=stock_num]").val(stock_num);
                                $(this).html("数据已生成").removeClass("btn-info").addClass("btn-success");
                            }else{
                                iosOverlay({
                                    text: "请先选择规格!",
                                    duration: 2e3,
                                    icon: "../../images/cross.png"
                                });
                            }

                        })*/
                    }
                    else if(cateSpec.length==1){
                        for(let i=0;i<shopSpec.length;i++){
                            let typevalcur=shopSpec[i].spec_one_name+"|&|"+shopSpec[i].stock_num+"|&|"+shopSpec[i].warning_num
                            typeval.push(typevalcur)
                        }
                        $("input[name=spec]").val(typeval);
                        console.log($("input[name=spec]").val())
                        stock_num=0;
                        typeary=[];
                        typeary.push(cateSpec[0].spec_name)
                        var spec_one_name=[];
                        spec_one_name=spec_one_name.unique1();
                        for(let j=0;j<shopSpec.length;j++){
                            spec_one_name.push(shopSpec[j].spec_one_name);
                            stock_num+=Number(shopSpec[j].stock_num);
                            tbodystr+=`<tr style="text-align: center">
                                                <td class="col-sm-2">${shopSpec[j].spec_one_name}</td>
                                                <td class="col-sm-2"><input type="text" class="inputcount" value=${shopSpec[j].stock_num}></td>
                                                <td class="col-sm-2"><input type="text" class="inputwramming" value=${shopSpec[j].warning_num}></td>
                                            </tr>`;
                        }
                        $("input[name=stock_num]").val(stock_num);
                        var str=`<a class="btn btn-info" role="button" id="editType" data-toggle="collapse" href="#collapseExample" aria-expanded="false" aria-controls="collapseExample">添加商品属性</a>
                    <div class="collapse" id="collapseExample">
                        <div class="well" style="background-color: #fff;" >
                                <div class="row" style="text-align: center" id="color">
                                    <label class="col-sm-2" style="font-weight: bold">${typeary[0]}：</label>
                                    <div class="col-sm-2">
                                        <input type="checkbox" class="colorcheck"  ${spec_one_name[0]?"checked":""}><input class="colorinput" type="text" value='${spec_one_name[0]?spec_one_name[0]:""}' style="width: 50px; border: 1px solid #CCCCCC" ${spec_one_name[0]?"":"disabled"}>
                                    </div>
                                    <div class="col-sm-2">
                                        <input type="checkbox" class="colorcheck" ${spec_one_name[1]?"checked":""}><input class="colorinput" type="text" value='${spec_one_name[1]?spec_one_name[1]:""}' style="width: 50px;border: 1px solid #CCCCCC"  ${spec_one_name[1]?"":"disabled"}>
                                    </div>
                                    <div class="col-sm-2">
                                        <input type="checkbox" class="colorcheck" ${spec_one_name[2]?"checked":""}><input class="colorinput" type="text" value='${spec_one_name[2]?spec_one_name[2]:""}' style="width: 50px;border: 1px solid #CCCCCC"  ${spec_one_name[2]?"":"disabled"} >
                                    </div>
                                      <div class="col-sm-2">
                                        <input type="checkbox" class="colorcheck" ${spec_one_name[3]?"checked":""}><input  class="colorinput" type="text" value='${spec_one_name[3]?spec_one_name[3]:""}' style="width: 50px; border: 1px solid #CCCCCC"  ${spec_one_name[3]?"":"disabled"} >
                                    </div>
                                </div>
                                <div class="row" style="text-align: center">
                                    <label class="col-sm-2"></label>
                                    <div class="col-sm-2">
                                        <input type="checkbox" class="colorcheck" ${spec_one_name[4]?"checked":""}><input class="colorinput" type="text" value='${spec_one_name[4]?spec_one_name[4]:""}' style="width: 50px;border: 1px solid #CCCCCC"  ${spec_one_name[4]?"":"disabled"}>
                                    </div>
                                    <div class="col-sm-2">
                                        <input type="checkbox" class="colorcheck" ${spec_one_name[5]?"checked":""}><input class="colorinput" type="text" value='${spec_one_name[5]?spec_one_name[5]:""}' style="width: 50px;border: 1px solid #CCCCCC"  ${spec_one_name[5]?"":"disabled"}>
                                    </div>
                                     <div class="col-sm-2">
                                        <input type="checkbox" class="colorcheck" ${spec_one_name[6]?"checked":""}><input class="colorinput" type="text" value='${spec_one_name[6]?spec_one_name[6]:""}' style="width: 50px;border: 1px solid #CCCCCC"  ${spec_one_name[6]?"":"disabled"}>
                                    </div>
                                     <div class="col-sm-2">
                                        <input type="checkbox" class="colorcheck" ${spec_one_name[7]?"checked":""}><input class="colorinput" type="text" value='${spec_one_name[7]?spec_one_name[7]:""}' style="width: 50px;border: 1px solid #CCCCCC"  ${spec_one_name[7]?"":"disabled"}>
                                    </div>
                                </div>
                                <div class="row" style="text-align: center;margin-top: 20px">
                                    <button class="btn btn-default" type="button" id="addtype">确定生成</button>
                                </div>
                                <div class="row" style="margin-top: 20px">
                                    <table class="goodtype-wrapper table table-striped"style="width: 100%">
                                        <thead  style="background-color: #eeeeee;">
                                            <tr style="text-align: center;height: 30px">
                                                <td class="col-sm-2">${typeary[0]}</td>
                                                <td class="col-sm-2"><i style="color: red">*</i>库存</td>
                                                <td class="col-sm-2">警戒库存</td>
                                            </tr>
                                        </thead>
                                        <tbody id="tbody">
                                        </tbody>
                                    </table>
                                </div>
                                <div class="row" style="text-align: center">
                                    <button type="button" class="btn btn-info" id="typeOk">确定</button>
                                </div>
                        </div>
                    </div>`;
                        $("#addType1").html(str);
                        $("#tbody").html(tbodystr);
                        $("#editType").trigger("click");
                        $(".colorcheck").each(function (index,item) {
                            $(item).click(
                                    function () {
                                        var index=$(this).index();
                                        $(".colorcheck").each(function (index, item) {
                                                    if($(this).is(':checked')){
                                                        // alert(index)
                                                        $($(".colorinput").get(index)).attr("disabled",false)
                                                    }else {
                                                        $($(".colorinput").get(index)).attr("disabled",true)
                                                    }
                                                }
                                        )
                                    });
                        });
                        $(document).on("click","#addtype",function () {
                            color=[];
                            var str='';
                            var bok=true;
                            $(".colorcheck").each(function (index, item) {
                                if(item.checked){
                                    var val=$($(".colorinput").get(index)).val();

                                    if(val){
                                        color.push(val)
                                    }else{
                                        bok=false;
                                        return;
                                    }
                                }
                            });
                            if(bok){
                                for (var i=0;i<color.length;i++){
                                    var curcolor=color[i];
                                    str+=`<tr style="text-align: center">
                                                <td class="col-sm-2">${curcolor}</td>
                                                <td class="col-sm-2"><input type="text" class="inputcount" value="0"></td>
                                                <td class="col-sm-2"><input type="text" class="inputwramming" value="10"></td>
                                            </tr>`
                                    var arykucun=[];
                                }
                                $("#tbody").html(str);
                                $("#typeOk").click(function () {
                                    stock_num=0
                                    var trcount=$("tbody tr").length;
                                    var datatye=[];
                                    if(trcount){
                                        for(var  i =0;i<trcount;i++){
                                            var str="";
                                            stock_num+=Number($($($("tbody tr").get(i)).children("td")[1]).children().val());
                                            str=$($($("tbody tr").get(i)).children("td")[0]).html()+'|&|'+$($($("tbody tr").get(i)).children("td")[1]).children().val()+'|&|'+$($($("tbody tr").get(i)).children("td")[2]).children().val();
                                            datatye.push(str);
                                        }
                                        $("input[name=spec]").val(datatye)
                                        console.log($("input[name=spec]").val())
                                        $("input[name=stock_num]").val(stock_num);
                                        $(this).html("数据已生成").removeClass("btn-info").addClass("btn-success");
                                    }else{
                                        iosOverlay({
                                            text: "请先选择规格!",
                                            duration: 2e3,
                                            icon: "../../images/cross.png"
                                        });
                                    }
                                })
                            }else{
                                iosOverlay({
                                    text: "请填写完整信息!",
                                    duration: 2e3,
                                    icon: "../../images/cross.png"
                                });
                            }


                        })
                    }
                }
                else{
                    if(confirm("还没有添加分类规格是否去添加！")){
                        window.location.href="http://kesu-shop.com/admin/category/specadd.html"
                    }else{
                        return false;
                    }
                }
            }
        });


        /*请求商品详情图片*/
        $.ajax({
            url:"{:url('/admin/goods/getGoodsSpec')}",
            data:{"type":3,"categroy_id":threeId,"shop_id":shopId},
            type:"post",
            async:false,
            dataType:"json",
            success: function (val) {

            }
        })
    };
    /*添加表格*/
    $.ajax({
        url:"{:url('/admin/goods/getCategroys')}",
        data:{"type":"", "categroy":""},
        type:"post",
        dataType:"json",
        success:function (val) {
            var str=`<option value="" id="sectionclass">请选择一级分类</option>`;
            val=JSON.parse(val);
            for(var i=0;i<val.length;i++){
                var cur=val[i];
                str+=`<option name="${cur.id}"  value="${cur.categroy_name}">${cur.categroy_name}</option>`;
            }
            $("#first").html("");
            $("#first").html(str);
        }
    });

    $("#first").change(getsection);
    $("#section").change(getthree);
    function getsection() {
        var selectoption= $("#first option:selected");
        var id=selectoption.attr("name");
        $.ajax({
            url:"{:url('/admin/goods/getCategroys')}",
            data:{"type":1, "categroy":id},
            type:"post",
            dataType:"json",
            async:false,
            success:function (val) {
                var str=`<option value="" id="sectionclass">请选择二级分类</option>`;
                val=JSON.parse(val);
                for(var i=0;i<val.length;i++){
                    var cur=val[i];
                    str+=`<option name="${cur.id}"  value="${cur.categroy_name}">${cur.categroy_name}</option>`;
                }
                $("#section").html("");
                $("#section").html(str);
            }
        })
    }
    function getthree(){
        var selectoption= $("#section option:selected");
        var id=selectoption.attr("name");
        $.ajax({
            url:"{:url('/admin/goods/getCategroys')}",
            data:{"type":2, "categroy":id},
            type:"post",
            dataType:"json",
            async:false,
            success:function (val) {
                var str=`<option value="" id="threeclass">请选择三级分类</option>`;
                val=JSON.parse(val);

                for(var i=0;i<val.length;i++){
                    var cur=val[i];
                    str+=`<option name="${cur.id}"  value="${cur.categroy_name}">${cur.categroy_name}</option>`;
                }
                $("#three").html("");
                $("#three").html(str);
            }
        })
    }
    $("#three").change(function(){
        var $threeoption=$("#three option:selected");
        var id=$threeoption.attr("name");
        $("#threeid").val(id);
    });
    /*请求商品规格规格*/
</script>
<script>
    /*添加规格 */
    var typeary=[];
    /*商品规格 颜色选择*/
    $(".colorcheck").each(function (index,item) {
        $(item).click(
                function () {
                    var index=$(this).index();
                    $(".colorcheck").each(function (index, item) {
                                if($(this).is(':checked')){
                                    // alert(index)
                                    $($(".colorinput").get(index)).attr("disabled",false)
                                }else {
                                    $($(".colorinput").get(index)).attr("disabled",true)
                                }
                            }
                    )
                });
    });
    /*商品规格 尺码选择*/

    var color=[];
    var size=[];
    $("#bok").click(function (){
         stock_num=0;
        var strclassname="";
        var ok=true;
        $("select>option:selected").each(function (index, item) {
            if($(item).val()==""){
                ok=false;
            }
            strclassname+=$(item).html()+">"
        });
        if(ok){
            strclassname=strclassname.substr(0,strclassname.length-1);
            var $threeoption=$("#three option:selected");
            var threeId=$threeoption.attr("name");
            $("#goodclass").html(strclassname);
            $.ajax({
                url:"{:url('/admin/goods/getCateSpec')}",
                data:{"type":3,"categroy":threeId},
                type:"post",
                async:false,
                dataType:"json",
                success:function (res) {
                    if(res.length){
                        typeary=[]
                        /*有两种规格的情况*/
                        if(res.length==2){
                            for(var i=0;i<res.length;i++){
                                var cur=res[i];
                                typeary.push(cur.spec_name)
                            }
                            var str=`<a class="btn btn-info" role="button" data-toggle="collapse" id="editType" href="#collapseExample" aria-expanded="false" aria-controls="collapseExample">添加商品属性</a>
                    <div class="collapse" id="collapseExample">
                        <div class="well" style="background-color: #fff;" >
                                <div class="row" style="text-align: center; id="color">
                                    <label class="col-sm-2" style="font-weight: bold">${typeary[0]}：</label>
                                    <div class="col-sm-2">
                                        <input type="checkbox" class="colorcheck"><input class="colorinput" type="text" value="" style="width: 50px; border: 1px solid #CCCCCC" disabled>
                                    </div>
                                    <div class="col-sm-2">
                                        <input type="checkbox" class="colorcheck"><input class="colorinput" type="text" value="" style="width: 50px;border: 1px solid #CCCCCC" disabled>
                                    </div>
                                    <div class="col-sm-2">
                                        <input type="checkbox" class="colorcheck"><input class="colorinput" type="text" value="" style="width: 50px;border: 1px solid #CCCCCC" disabled >
                                    </div>
                                     <div class="col-sm-2">
                                        <input type="checkbox" class="colorcheck"><input class="colorinput" type="text" value="" style="width: 50px;border: 1px solid #CCCCCC" disabled >
                                    </div>
                                </div>
                                <div class="row" style="text-align: center">
                                    <label class="col-sm-2"></label>
                                    <div class="col-sm-2">
                                        <input type="checkbox" class="colorcheck"><input  class="colorinput" type="text" value="" style="width: 50px; border: 1px solid #CCCCCC" disabled >
                                    </div>
                                    <div class="col-sm-2">
                                        <input type="checkbox" class="colorcheck"><input class="colorinput" type="text" value="" style="width: 50px;border: 1px solid #CCCCCC" disabled>
                                    </div>
                                    <div class="col-sm-2">
                                        <input type="checkbox" class="colorcheck"><input class="colorinput" type="text" value="" style="width: 50px;border: 1px solid #CCCCCC" disabled>
                                    </div>
                                    <div class="col-sm-2">
                                        <input type="checkbox" class="colorcheck"><input class="colorinput" type="text" value="" style="width: 50px;border: 1px solid #CCCCCC" disabled>
                                    </div>
                                </div>
                                 <div class="row" style="text-align: center">
                                    <label class="col-sm-2"></label>
                                    <div class="col-sm-2">
                                        <input type="checkbox" class="colorcheck"><input  class="colorinput" type="text" value="" style="width: 50px; border: 1px solid #CCCCCC" disabled >
                                    </div>
                                    <div class="col-sm-2">
                                        <input type="checkbox" class="colorcheck"><input class="colorinput" type="text" value="" style="width: 50px;border: 1px solid #CCCCCC" disabled>
                                    </div>
                                    <div class="col-sm-2">
                                        <input type="checkbox" class="colorcheck"><input class="colorinput" type="text" value="" style="width: 50px;border: 1px solid #CCCCCC" disabled>
                                    </div>
                                    <div class="col-sm-2">
                                        <input type="checkbox" class="colorcheck"><input class="colorinput" type="text" value="" style="width: 50px;border: 1px solid #CCCCCC" disabled>
                                    </div>
                                </div>
                                <div class="row" style="text-align: center;margin-top: 20px">
                                    <label class="col-sm-2" style="font-weight: bold">${typeary[1]}:</label>
                                    <div class="col-sm-2">
                                        <input type="checkbox" class="sizecheck"><input  class="sizeinput" type="text" value="" style="width: 50px; border: 1px solid #CCCCCC" disabled >
                                    </div>
                                    <div class="col-sm-2">
                                        <input type="checkbox" class="sizecheck"><input class="sizeinput" type="text" value="" style="width: 50px;border: 1px solid #CCCCCC" disabled>
                                    </div>
                                    <div class="col-sm-2">
                                        <input type="checkbox" class="sizecheck"><input class="sizeinput" type="text" value="" style="width: 50px;border: 1px solid #CCCCCC" disabled>
                                    </div>
                                    <div class="col-sm-2">
                                        <input type="checkbox" class="sizecheck"><input class="sizeinput" type="text" value="" style="width: 50px;border: 1px solid #CCCCCC" disabled>
                                    </div>
                                </div>
                                <div class="row" style="text-align: center">
                                    <label class="col-sm-2"></label>
                                    <div class="col-sm-2">
                                        <input type="checkbox" class="sizecheck"><input  class="sizeinput" type="text" value="" style="width: 50px; border: 1px solid #CCCCCC" disabled >
                                    </div>
                                    <div class="col-sm-2">
                                        <input type="checkbox" class="sizecheck"><input class="sizeinput" type="text" value="" style="width: 50px;border: 1px solid #CCCCCC" disabled>
                                    </div>
                                    <div class="col-sm-2">
                                        <input type="checkbox" class="sizecheck"><input class="sizeinput" type="text" value="" style="width: 50px;border: 1px solid #CCCCCC" disabled>
                                    </div>
                                    <div class="col-sm-2">
                                        <input type="checkbox" class="sizecheck"><input class="sizeinput" type="text" value="" style="width: 50px;border: 1px solid #CCCCCC" disabled>
                                    </div>
                                </div>
                                 <div class="row" style="text-align: center">
                                    <label class="col-sm-2"></label>
                                    <div class="col-sm-2">
                                        <input type="checkbox" class="sizecheck"><input  class="sizeinput" type="text" value="" style="width: 50px; border: 1px solid #CCCCCC" disabled >
                                    </div>
                                    <div class="col-sm-2">
                                        <input type="checkbox" class="sizecheck"><input class="sizeinput" type="text" value="" style="width: 50px;border: 1px solid #CCCCCC" disabled>
                                    </div>
                                    <div class="col-sm-2">
                                        <input type="checkbox" class="sizecheck"><input class="sizeinput" type="text" value="" style="width: 50px;border: 1px solid #CCCCCC" disabled>
                                    </div>
                                    <div class="col-sm-2">
                                        <input type="checkbox" class="sizecheck"><input class="sizeinput" type="text" value="" style="width: 50px;border: 1px solid #CCCCCC" disabled>
                                    </div>
                                </div>
                                <div class="row" style="text-align: center;margin-top: 20px">
                                    <button class="btn btn-default" type="button" id="addtype">确定生成</button>
                                </div>

                        </div>
                    </div>`;
                            $("#addType1").html(str);
                            $("#goodclass").html(strclassname);
                            $("#editType").trigger("click");
                            $(".colorcheck").each(function (index,item) {
                                $(item).click(
                                        function () {
                                            var index=$(this).index();
                                            $(".colorcheck").each(function (index, item) {
                                                        if($(this).is(':checked')){
                                                            // alert(index)
                                                            $($(".colorinput").get(index)).attr("disabled",false)
                                                        }else {
                                                            $($(".colorinput").get(index)).attr("disabled",true)
                                                        }
                                                    }
                                            )
                                        });
                            });
                            /*商品规格 尺码选择*/
                            $(".sizecheck").each(function (index,item) {
                                $(item).click(
                                        function () {
                                            var index=$(this).index();
                                            $(".sizecheck").each(function (index, item) {
                                                        if($(this).is(':checked')){
                                                            // alert(index)
                                                            $($(".sizeinput").get(index)).attr("disabled",false);
                                                        }else {

                                                            $($(".sizeinput").get(index)).attr("disabled",true)
                                                        }
                                                    }
                                            )
                                        });
                            });
                            $(document).on("click","#addtype",function () {
                                color=[];
                                size=[];
                                var str="";
                                var bok=true;
                                $(".colorcheck").each(function (index, item) {
                                    if(item.checked){
                                        var val=$($(".colorinput").get(index)).val();

                                        if(val){
                                            color.push(val)
                                        }else{
                                            bok=false;
                                            return;
                                        }
                                    }
                                });
                                $(".sizecheck").each(function (index, item) {
                                    if(item.checked){
                                        var val=$($(".sizeinput").get(index)).val();
                                        if(val){
                                            size.push(val)
                                        }else{
                                            bok=false;
                                            return;
                                        }
                                    }
                                });
                                if(bok){
                                    for (var i=0;i<color.length;i++){
                                        var curcolor=color[i];
                                        for(var j=0;j<size.length;j++){
                                            var cursize=size[j];
                                            str+=`<tr style="text-align: center">
                                                <td class="col-sm-2">${curcolor}</td>
                                                <td class="col-sm-2">${cursize}</td>
                                                <td class="col-sm-2"><input type="text" class="inputcount" value="0"></td>
                                                <td class="col-sm-2"><input type="text" class="inputwramming" value="10"></td>
                                            </tr>`
                                        }
                                        var arykucun=[];
                                    }
                                    var tb=`
                                    <div class="form-inline pull-right" style="margin: 30px 0" >
  <div class="form-group">
    <label for="exampleInputEmail2">批量设置:</label>
    <input type="text" class="form-control" style="width:120px" id="stock" placeholder="库存">
    <input type="text" class="form-control" style="width:120px" id="wraningStock" placeholder="预警库存"><button class="btn btn-default" type="button" id="PLSZbtn">确定</button>
  </div>
</div>
                                   <div class="row" style="margin-top: 20px">
                                    <table class="goodtype-wrapper table table-striped"style="width: 100%">
                                        <thead  style="background-color: #eeeeee;">
                                            <tr style="text-align: center;height: 30px">
                                                <td class="col-sm-2">${typeary[0]}</td>
                                                <td class="col-sm-2">${typeary[1]}</td>
                                                <td class="col-sm-2"><i style="color: red">*</i>库存</td>
                                                <td class="col-sm-2">警戒库存</td>
                                            </tr>
                                        </thead>
                                        <tbody id="tbody">
                                        ${str}
                                        </tbody>
                                    </table>
                                </div>
                                <div class="row" style="text-align: center">
                                    <button type="button" class="btn btn-success" id="typeReok">确定</button>
                                </div>`
                                    $(".well").append(tb);
                                    /*点击确定生成数据*/
                                    $("#PLSZbtn").click(function(){
                                        var stockval=Number($("#stock").val());
                                        var wraningStockval=$("#wraningStock").val();
                                        if(stockval ){
                                            if(!isNaN(stockval)){
                                                $(".inputcount").val(stockval);
                                            }else{
                                                iosOverlay({
                                                    text: "库存必须为数字!",
                                                    duration: 2e3,
                                                    icon: "../../images/cross.png"
                                                });
                                            }

                                        }
                                        if(wraningStockval){
                                            if(!isNaN(wraningStockval)){
                                                $(".inputwramming").val(wraningStockval);
                                            }else{
                                                iosOverlay({
                                                    text: "预警库存必须为数字!",
                                                    duration: 2e3,
                                                    icon: "../../images/cross.png"
                                                });}

                                        }


                                    });
                                    $("#typeReok").click(function () {
                                        var trcount=$("tbody tr").length;
                                        var datatye=[];
                                        if(trcount){
                                            stock_num=0;
                                            for(var  i =0;i<trcount;i++){
                                                var str="";
                                                 stock_num+=Number($($($("tbody tr").get(i)).children("td")[2]).children().val());
                                                str=$($($("tbody tr").get(i)).children("td")[0]).html()+'|&|'+$($($("tbody tr").get(i)).children("td")[1]).html()+'|&|'+$($($("tbody tr").get(i)).children("td")[2]).children().val()+'|&|'+$($($("tbody tr").get(i)).children("td")[3]).children().val();
                                                datatye.push(str);
                                            }
                                            $("input[name=spec]").val(datatye)
                                            console.log(datatye)
                                            $("input[name=stock_num]").val(stock_num);
                                            $(this).html("数据已生成").removeClass("btn-info").addClass("btn-success");
                                            console.log(stock_num);
                                        }else{
                                            iosOverlay({
                                                text: "请先选择规格!",
                                                duration: 2e3,
                                                icon: "../../images/cross.png"
                                            });
                                        }

                                    })
                                }else{
                                    iosOverlay({
                                        text: "请填写完整信息!",
                                        duration: 2e3,
                                        icon: "../../images/cross.png"
                                    });
                                }
                            })
                        }
                        else if(res.length==1){
                            stock_num=0;
                            typeary=[];
                            typeary.push(res[0].spec_name)
                            var str=`<a class="btn btn-info" role="button" data-toggle="collapse" href="#collapseExample" aria-expanded="false" aria-controls="collapseExample">添加商品属性</a>
                    <div class="collapse" id="collapseExample">
                        <div class="well" style="background-color: #fff;" >
                                <div class="row" style="text-align: center" id="color">
                                    <label class="col-sm-2" style="font-weight: bold">${typeary[0]}：</label>
                                    <div class="col-sm-3">
                                        <input type="checkbox" class="colorcheck"><input class="colorinput" type="text" value="" style="width: 50px; border: 1px solid #CCCCCC" disabled>
                                    </div>
                                    <div class="col-sm-3">
                                        <input type="checkbox" class="colorcheck"><input class="colorinput" type="text" value="" style="width: 50px;border: 1px solid #CCCCCC" disabled>
                                    </div>
                                    <div class="col-sm-3">
                                        <input type="checkbox" class="colorcheck"><input class="colorinput" type="text" value="" style="width: 50px;border: 1px solid #CCCCCC" disabled >
                                    </div>
                                </div>
                                <div class="row" style="text-align: center">
                                    <label class="col-sm-2"></label>
                                    <div class="col-sm-3">
                                        <input type="checkbox" class="colorcheck"><input  class="colorinput" type="text" value="" style="width: 50px; border: 1px solid #CCCCCC" disabled >
                                    </div>
                                    <div class="col-sm-3">
                                        <input type="checkbox" class="colorcheck"><input class="colorinput" type="text" value="" style="width: 50px;border: 1px solid #CCCCCC" disabled>
                                    </div>
                                    <div class="col-sm-3">
                                        <input type="checkbox" class="colorcheck"><input class="colorinput" type="text" value="" style="width: 50px;border: 1px solid #CCCCCC" disabled>
                                    </div>
                                </div>
                                <div class="row" style="text-align: center;margin-top: 20px">
                                    <button class="btn btn-default" type="button" id="addtype">确定生成</button>
                                </div>
                                <div class="row" style="margin-top: 20px">
                                    <table class="goodtype-wrapper table table-striped"style="width: 100%">
                                        <thead  style="background-color: #eeeeee;">
                                            <tr style="text-align: center;height: 30px">
                                                <td class="col-sm-2">${typeary[0]}</td>
                                                <td class="col-sm-2"><i style="color: red">*</i>库存</td>
                                                <td class="col-sm-2">警戒库存</td>
                                            </tr>
                                        </thead>
                                        <tbody id="tbody">
                                        </tbody>
                                    </table>
                                </div>
                                <div class="row" style="text-align: center">
                                    <button type="button" class="btn btn-info" id="typeReok">确定</button>
                                </div>
                        </div>
                    </div>`;
                            $("#addType1").html(str);
                            $("#goodclass").html(strclassname);
                            $("#editType").trigger("click");
                            $(".colorcheck").each(function (index,item) {
                                $(item).click(
                                        function () {
                                            var index=$(this).index();
                                            $(".colorcheck").each(function (index, item) {
                                                        if($(this).is(':checked')){
                                                            // alert(index)
                                                            $($(".colorinput").get(index)).attr("disabled",false)
                                                        }else {
                                                            $($(".colorinput").get(index)).attr("disabled",true)
                                                        }
                                                    }
                                            )
                                        });
                            });
                            $(document).on("click","#addtype",function () {
                                color=[];
                                var str='';
                                var bok=true;
                                $(".colorcheck").each(function (index, item) {
                                    if(item.checked){
                                        var val=$($(".colorinput").get(index)).val();

                                        if(val){
                                            color.push(val)
                                        }else{
                                            bok=false;
                                            return;
                                        }
                                    }
                                });
                                if(bok){
                                    for (var i=0;i<color.length;i++){
                                        var curcolor=color[i];

                                        str+=`<tr style="text-align: center">
                                                <td class="col-sm-2">${curcolor}</td>
                                                <td class="col-sm-2"><input type="text" class="inputcount" value="0"></td>
                                                <td class="col-sm-2"><input type="text" class="inputwramming" value="10"></td>
                                            </tr>`
                                        var arykucun=[];
                                    }
                                    $("#tbody").html(str);
                                    $("#typeReok").click(function () {
                                        var trcount=$("tbody tr").length;
                                        var datatye=[];
                                        if(trcount){
                                            for(var  i =0;i<trcount;i++){
                                                var str="";
                                                stock_num+=Number($($($("tbody tr").get(i)).children("td")[1]).children().val());
                                                str=$($($("tbody tr").get(i)).children("td")[0]).html()+'|&|'+$($($("tbody tr").get(i)).children("td")[1]).children().val()+'|&|'+$($($("tbody tr").get(i)).children("td")[2]).children().val();
                                                datatye.push(str);
                                            }
                                            var str=`<input type="text" hidden name="spec" value="${datatye}">`;
                                            $("#typewrapper").html(str);
                                            console.log(stock_num)
                                            $("input[name=stock_num]").val(stock_num)
                                            $(this).html("数据已生成").removeClass("btn-info").addClass("btn-success");
                                        }else{
                                            iosOverlay({
                                                text: "请先选择规格!",
                                                duration: 2e3,
                                                icon: "../../images/cross.png"
                                            });
                                        }
                                    })
                                }else{
                                    iosOverlay({
                                        text: "请填写完整信息!",
                                        duration: 2e3,
                                        icon: "../../images/cross.png"
                                    });
                                }
                            })
                        }
                    }
                    else{
                        if(confirm("还没有添加分类规格是否去添加！")){
                            window.location.href="/admin/category/specadd"
                        }else{
                            return false;
                        }

                    }
                }
            })
        }else{
            iosOverlay({
                text: "请选择完整分类",
                duration: 2e3,
                icon: "../../images/cross.png"
            });
            return;
        }
    });



</script>
<script>
    $(function(){
        var delParent;
        var defaults = {
            fileType: ["jpg", "png", "bmp", "jpeg"],   // 上传文件的类型
            fileSize: 1024 * 1024 * 3 // 上传文件的大小 10M
        };
        /*商品详情多张图片上传*/
        /*商品橱窗图片上传*/
        $(".filecc").change(function(){
            var fileval=this.files[0];
            var formData= new FormData();
            formData.append("image",fileval);
            console.log(formData);
            if(!$(this).prop("oldimg")){
                $(this).prop("oldimg",$("input[name=image]").val());
                console.log($(this).prop("oldimg"))
            }
            var thisimg=this;
            $.ajax({
                url: "{:url('/admin/goods/pictureHandle')}",
                type: "post",
                data: formData,
                contentType: false,
                processData: false,
                mimeType: "multipart/form-data",
                success: function (data) {
                    data= data.replace(/\\\\/g ,"\\" );
                    data=data.replace(/\"/g,"");
                    console.log(data);
                    $("input[name=image]").val(data)
                },
                error: function (data) {
                    console.log(data);
                }
            });
            var idFile = $(this).attr("id");
            var file = document.getElementById(idFile);
            var imgContainer = $(this).parents(".z_photo"); //存放图片的父亲元素
            var fileList = file.files; //获取的图片文件
            var input = $(this).parent();//文本框的父亲元素
            var imgArr = [];
            //遍历得到的图片文件
            var numUp = imgContainer.find(".up-section").length;
            var totalNum = numUp + fileList.length;  //总的数量
            if(fileList.length > 1 || totalNum > 1 ){
                alert("上传图片数目不可以超过1个，请重新选择");  //一次选择上传超过1个 或者是已经上传和这次上传的到的总数也不可以超过5个
            }
            else if(numUp < 1){
                fileList = validateUp(fileList);
                for(var i = 0;i<fileList.length;i++){
                    var imgUrl = window.URL.createObjectURL(fileList[i]);
                    // var imgUrl = window.URL.createObjectURL(fileList[i]);
                    var newimg=new Image();
                    $(newimg).attr("src",imgUrl);
                    newimg.onload=function () {
                        console.log(newimg);
                        console.log(newimg.width,newimg.height);
                        if(newimg.width!=368 || newimg.height!=368){
                            method.msg_layer({
                                title: "提示信息",
                                content:"建议上传尺寸368*368px!",
                                btn: ["确定",""]
                            });
                        }
                    };
                    imgArr.push(imgUrl);
                    var $section = $("<section class='up-section fl loading'>");
                    imgContainer.prepend($section);
                    var $span = $("<span class='up-span'>");
                    $span.appendTo($section);
                    var $img0 = $("<img class='close-upimg'>").on("click",function(event){
                        event.preventDefault();
                        event.stopPropagation();
                        $(".works-mask").show();
                        delParent = $(this).parent();
                    });
                    $img0.attr("src","/images/delete_tu.png").appendTo($section);
                    var $img = $("<img class='up-img up-opcity'>");
                    $img.attr("src",imgArr[i]);
                    $img.appendTo($section);
                    var $p = $("<p class='img-name-p'>");
                    $p.html(fileList[i].name).appendTo($section);
                    // var $input = $("<input id='taglocation' name='taglocation' value='' type='hidden'>");
                    // $input.appendTo($section);
                    // var $input2 = $("<input id='tags' name='tags' value='' type='hidden'/>");
                    // $input2.appendTo($section);
                }
            }
            setTimeout(function(){
                $(".up-section").removeClass("loading");
                $(".up-img").removeClass("up-opcity");
            },450);
            numUp = imgContainer.find(".up-section").length;
            if(numUp >= 1){
                $(this).parent().hide();
            }
        });
        /*商品详情介绍单张图片上传*/
        /*banner图片上传按钮*/
        $("#banner1").change(function(){
            var fileval=this.files[0];
            var formData= new FormData();
            formData.append("image",fileval);
            console.log(formData);
            if(!$(this).prop("oldimg")){
                $(this).prop("oldimg",$(".banner0").val());
                console.log($(this).prop("oldimg"))
            }
            var thisimg=this;
            $.ajax({
                url: "{:url('/admin/goods/pictureHandle')}",
                type: "post",
                data: formData,
                contentType: false,
                processData: false,
                mimeType: "multipart/form-data",
                success: function (data) {
                    data= data.replace(/\\\\/g ,"\\" );
                    console.log(data);
                    data=data.replace(/\"/g,"");
                    var id=$($(".bannerid").get(0)).val();
                    var obj=`${id};${data}`;
                    console.log(obj)
                    $(".banner0").val(obj)
                },
                error: function (data) {
                    console.log(data);
                }
            });
            var idFile = $(this).attr("id");
            var file = document.getElementById(idFile);
            var imgContainer = $(this).parents(".z_photo"); //存放图片的父亲元素
            var fileList = file.files; //获取的图片文件
            var input = $(this).parent();//文本框的父亲元素
            var imgArr = [];
            //遍历得到的图片文件
            var numUp = imgContainer.find(".up-section").length;
            var totalNum = numUp + fileList.length;  //总的数量
            if(fileList.length > 1 || totalNum > 1 ){
                alert("上传图片数目不可以超过1个，请重新选择");  //一次选择上传超过1个 或者是已经上传和这次上传的到的总数也不可以超过5个
            }
            else if(numUp < 1){
                fileList = validateUp(fileList);
                for(var i = 0;i<fileList.length;i++){
                    var imgUrl = window.URL.createObjectURL(fileList[i]);
                    var newimg=new Image();
                    $(newimg).attr("src",imgUrl);
                    newimg.onload=function () {
                        console.log(newimg)
                        console.log(newimg.width,newimg.height);
                        if(newimg.width!=368 || newimg.height!=368){
                            /*alert("（建议上传图片大小368X368px）")*/
                            iosOverlay({
                                text: "建议上传尺寸750*750px!",
                                duration: 2e3,
                                icon: "../../images/cross.png"
                            });
                            /*
                             method.msg_layer({
                             title: "提示信息",
                             content:"建议上传尺寸750*750px!",
                             btn: ["确定",""]
                             });*/
                        }
                    };
                    imgArr.push(imgUrl);
                    var $section = $("<section class='up-section fl loading'>");
                    imgContainer.prepend($section);
                    var $span = $("<span class='up-span'>");
                    $span.appendTo($section);
                    var $img0 = $("<img class='close-upimg'>").on("click",function(event){
                        event.preventDefault();
                        event.stopPropagation();
                        $(".works-mask").show();
                        delParent = $(this).parent();
                    });
                    $img0.attr("src","/images/delete_tu.png").appendTo($section);
                    var $img = $("<img class='up-img up-opcity'>");
                    $img.attr("src",imgArr[i]);
                    $img.appendTo($section);
                    var $p = $("<p class='img-name-p'>");
                    $p.html(fileList[i].name).appendTo($section);
                    // var $input = $("<input id='taglocation' name='taglocation' value='' type='hidden'>");
                    // $input.appendTo($section);
                    // var $input2 = $("<input id='tags' name='tags' value='' type='hidden'/>");
                    // $input2.appendTo($section);

                }
            }
            setTimeout(function(){
                $(".up-section").removeClass("loading");
                $(".up-img").removeClass("up-opcity");
            },450);
            numUp = imgContainer.find(".up-section").length;
            if(numUp >= 1){
                $(this).parent().hide();
            }
        });
        $("#banner2").change(function(){
            var fileval=this.files[0];
            var formData= new FormData();
            formData.append("image",fileval);
            console.log(formData);
            if(!$(this).prop("oldimg")){
                $(this).prop("oldimg",$(".banner1").val());
                console.log($(this).prop("oldimg"))
            }
            var thisimg=this;
            $.ajax({
                url: "{:url('/admin/goods/pictureHandle')}",
                type: "post",
                data: formData,
                contentType: false,
                processData: false,
                mimeType: "multipart/form-data",
                success: function (data) {
                    data= data.replace(/\\\\/g ,"\\" );
                    console.log(data);
                    data=data.replace(/\"/g,"");
                    var id=$($(".bannerid").get(1)).val();
                    var obj=`${id};${data}`;
                    $(".banner1").val(obj)

                },
                error: function (data) {
                    console.log(data);
                }
            });
            var idFile = $(this).attr("id");
            var file = document.getElementById(idFile);
            var imgContainer = $(this).parents(".z_photo"); //存放图片的父亲元素
            var fileList = file.files; //获取的图片文件
            var input = $(this).parent();//文本框的父亲元素
            var imgArr = [];
            //遍历得到的图片文件
            var numUp = imgContainer.find(".up-section").length;
            var totalNum = numUp + fileList.length;  //总的数量
            if(fileList.length > 1 || totalNum > 1 ){
                alert("上传图片数目不可以超过1个，请重新选择");  //一次选择上传超过1个 或者是已经上传和这次上传的到的总数也不可以超过5个
            }
            else if(numUp < 1){
                fileList = validateUp(fileList);
                for(var i = 0;i<fileList.length;i++){
                    var imgUrl = window.URL.createObjectURL(fileList[i]);
                    var newimg=new Image();
                    $(newimg).attr("src",imgUrl);
                    newimg.onload=function () {
                        console.log(newimg)
                        console.log(newimg.width,newimg.height);
                        if(newimg.width!=368 || newimg.height!=368){
                            /*alert("（建议上传图片大小368X368px）")*/
                            iosOverlay({
                                text: "建议上传尺寸750*750px!",
                                duration: 2e3,
                                icon: "../../images/cross.png"
                            });
                            /*
                             method.msg_layer({
                             title: "提示信息",
                             content:"建议上传尺寸750*750px!",
                             btn: ["确定",""]
                             });*/
                        }
                    };
                    imgArr.push(imgUrl);
                    var $section = $("<section class='up-section fl loading'>");
                    imgContainer.prepend($section);
                    var $span = $("<span class='up-span'>");
                    $span.appendTo($section);
                    var $img0 = $("<img class='close-upimg'>").on("click",function(event){
                        event.preventDefault();
                        event.stopPropagation();
                        $(".works-mask").show();
                        delParent = $(this).parent();
                    });
                    $img0.attr("src","/images/delete_tu.png").appendTo($section);
                    var $img = $("<img class='up-img up-opcity'>");
                    $img.attr("src",imgArr[i]);
                    $img.appendTo($section);
                    var $p = $("<p class='img-name-p'>");
                    $p.html(fileList[i].name).appendTo($section);
                    // var $input = $("<input id='taglocation' name='taglocation' value='' type='hidden'>");
                    // $input.appendTo($section);
                    // var $input2 = $("<input id='tags' name='tags' value='' type='hidden'/>");
                    // $input2.appendTo($section);

                }
            }
            setTimeout(function(){
                $(".up-section").removeClass("loading");
                $(".up-img").removeClass("up-opcity");
            },450);
            numUp = imgContainer.find(".up-section").length;
            if(numUp >= 1){
                $(this).parent().hide();
            }
        });
        $("#banner3").change(function(){
            var fileval=this.files[0];
            var formData= new FormData();
            formData.append("image",fileval);
            console.log(formData);
            if(!$(this).prop("oldimg")){
                $(this).prop("oldimg",$(".banner3").val())
                console.log($(this).prop("oldimg"))
            }
            var thisimg=this;
            $.ajax({
                url: "{:url('/admin/goods/pictureHandle')}",
                type: "post",
                data: formData,
                contentType: false,
                processData: false,
                mimeType: "multipart/form-data",
                success: function (data) {
                    data= data.replace(/\\\\/g ,"\\" );
                    data=data.replace(/\"/g,"");
                    console.log(data);
                    var id=$($(".bannerid").get(2)).val();
                    var obj=`${id};${data}`;
                    $(".banner2").val(obj)
                },
                error: function (data) {
                    console.log(data);
                }
            });
            var idFile = $(this).attr("id");
            var file = document.getElementById(idFile);
            var imgContainer = $(this).parents(".z_photo"); //存放图片的父亲元素
            var fileList = file.files; //获取的图片文件
            var input = $(this).parent();//文本框的父亲元素
            var imgArr = [];
            //遍历得到的图片文件
            var numUp = imgContainer.find(".up-section").length;
            var totalNum = numUp + fileList.length;  //总的数量
            if(fileList.length > 1 || totalNum > 1 ){
                alert("上传图片数目不可以超过1个，请重新选择");  //一次选择上传超过1个 或者是已经上传和这次上传的到的总数也不可以超过5个
            }
            else if(numUp < 1){
                fileList = validateUp(fileList);
                for(var i = 0;i<fileList.length;i++){
                    var imgUrl = window.URL.createObjectURL(fileList[i]);
                    var newimg=new Image();
                    $(newimg).attr("src",imgUrl);
                    newimg.onload=function () {
                        console.log(newimg)
                        console.log(newimg.width,newimg.height);
                        if(newimg.width!=368 || newimg.height!=368){
                            /*alert("（建议上传图片大小368X368px）")*/
                            iosOverlay({
                                text: "建议上传尺寸750*750px!",
                                duration: 2e3,
                                icon: "../../images/cross.png"
                            });
                            /*
                             method.msg_layer({
                             title: "提示信息",
                             content:"建议上传尺寸750*750px!",
                             btn: ["确定",""]
                             });*/
                        }
                    };
                    imgArr.push(imgUrl);
                    var $section = $("<section class='up-section fl loading'>");
                    imgContainer.prepend($section);
                    var $span = $("<span class='up-span'>");
                    $span.appendTo($section);
                    var $img0 = $("<img class='close-upimg'>").on("click",function(event){
                        event.preventDefault();
                        event.stopPropagation();
                        $(".works-mask").show();
                        delParent = $(this).parent();
                    });
                    $img0.attr("src","/images/delete_tu.png").appendTo($section);
                    var $img = $("<img class='up-img up-opcity'>");
                    $img.attr("src",imgArr[i]);
                    $img.appendTo($section);
                    var $p = $("<p class='img-name-p'>");
                    $p.html(fileList[i].name).appendTo($section);
                    // var $input = $("<input id='taglocation' name='taglocation' value='' type='hidden'>");
                    // $input.appendTo($section);
                    // var $input2 = $("<input id='tags' name='tags' value='' type='hidden'/>");
                    // $input2.appendTo($section);

                }
            }
            setTimeout(function(){
                $(".up-section").removeClass("loading");
                $(".up-img").removeClass("up-opcity");
            },450);
            numUp = imgContainer.find(".up-section").length;
            if(numUp >= 1){
                $(this).parent().hide();
            }
        });
        $(document).on("change","#shi01",function (){
            var fileval=this.files[0];
            var formData= new FormData();
            formData.append("image",fileval);
            console.log(formData);
            if(!$(this).prop("oldimg")){
                $(this).prop("oldimg",$(".desc1").val());
                console.log($(this).prop("oldimg"))
            }
            var thisimg=this;
            $.ajax({
                url: "{:url('/admin/goods/pictureHandle')}",
                type: "post",
                data: formData,
                contentType: false,
                processData: false,
                mimeType: "multipart/form-data",
                success: function (data) {
                    data= data.replace(/\\\\/g ,"\\" );
                    console.log(data);
                    data=data.replace(/\"/g,"");
                    var id=$(".descimgid").get(0).value?$(".descimgid").get(0).value:"new";
                    var imgdescidpath=`${id};${data}`;
                    $($(".det").get(0)).val(imgdescidpath);
                },
                error: function (data) {
                    console.log(data);
                }
            });
            var idFile = $(this).attr("id");
            var file = document.getElementById(idFile);
            var imgContainer = $(this).parents(".z_photo"); //存放图片的父亲元素
            var fileList = file.files; //获取的图片文件
            var input = $(this).parent();//文本框的父亲元素
            var imgArr = [];
            //遍历得到的图片文件
            var numUp = imgContainer.find(".up-section").length;
            var totalNum = numUp + fileList.length;  //总的数量
            if(fileList.length > 1 || totalNum > 1 ){
                alert("上传图片数目不可以超过1个，请重新选择");  //一次选择上传超过1个 或者是已经上传和这次上传的到的总数也不可以超过5个
            }
            else if(numUp < 1){
                fileList = validateUp(fileList);
                for(var i = 0;i<fileList.length;i++){
                    var imgUrl = window.URL.createObjectURL(fileList[i]);
                    var newimg=new Image();
                    $(newimg).attr("src",imgUrl);
                    newimg.onload=function (){
                        console.log(newimg);
                        console.log(newimg.width,newimg.height);
                        if(newimg.width>800 ){
                            iosOverlay({
                                text: "图片太宽了",
                                duration: 2e3,
                                icon: "../../images/cross.png"
                            });
                        }else if(newimg.width<700){
                            iosOverlay({
                                text: "图片太窄了",
                                duration: 2e3,
                                icon: "../../images/cross.png"
                            });
                        }
                    };
                    imgArr.push(imgUrl);
                    var $section = $("<section class='up-section fl loading'>");
                    imgContainer.prepend($section);
                    var $span = $("<span class='up-span'>");
                    $span.appendTo($section);
                    var $img0 = $("<img class='close-upimg'>").on("click",function(event){
                        event.preventDefault();
                        event.stopPropagation();
                        $(".works-mask").show();
                        delParent = $(this).parent();
                    });
                    $img0.attr("src","/images/delete_tu.png").appendTo($section);
                    var $img = $("<img class='up-img up-opcity'>");
                    $img.attr("src",imgArr[i]);
                    $img.appendTo($section);
                }
            }
            setTimeout(function(){
                $(".up-section").removeClass("loading");
                $(".up-img").removeClass("up-opcity");
            },450);
            numUp = imgContainer.find(".up-section").length;
            if(numUp >= 1){
                $(this).parent().hide();
            }
        });
        $(document).on("change","#shi02",function () {
            var fileval=this.files[0];
            var formData= new FormData();
            formData.append("image",fileval);
            console.log(formData);
            if(!$(this).prop("oldimg")){
                $(this).prop("oldimg",$(".desc2").val())
                console.log($(this).prop("oldimg"))
            }
            var thisimg=this;
            $.ajax({
                url: "{:url('/admin/goods/pictureHandle')}",
                type: "post",
                data: formData,
                contentType: false,
                processData: false,
                mimeType: "multipart/form-data",
                success: function (data) {
                    data= data.replace(/\\\\/g ,"\\" );
                    console.log(data);
                    data=data.replace(/\"/g,"");
                    var id=$(".descimgid").get(1).value?$(".descimgid").get(1).value:"new";
                    var imgdescidpath=`${id};${data}`;
                    $($(".det").get(1)).val(imgdescidpath);
                },
                error: function (data) {
                    console.log(data);
                }
            });
            var idFile = $(this).attr("id");
            var file = document.getElementById(idFile);
            var imgContainer = $(this).parents(".z_photo"); //存放图片的父亲元素
            var fileList = file.files; //获取的图片文件
            var input = $(this).parent();//文本框的父亲元素
            var imgArr = [];
            //遍历得到的图片文件
            var numUp = imgContainer.find(".up-section").length;
            var totalNum = numUp + fileList.length;  //总的数量
            if(fileList.length > 1 || totalNum > 1 ){
                alert("上传图片数目不可以超过1个，请重新选择");  //一次选择上传超过1个 或者是已经上传和这次上传的到的总数也不可以超过5个
            }
            else if(numUp < 1){
                fileList = validateUp(fileList);
                for(var i = 0;i<fileList.length;i++){
                    var imgUrl = window.URL.createObjectURL(fileList[i]);
                    var newimg=new Image();
                    $(newimg).attr("src",imgUrl);
                    newimg.onload=function (){
                        console.log(newimg);
                        console.log(newimg.width,newimg.height);
                        if(newimg.width>800 ){
                            iosOverlay({
                                text: "图片太宽了",
                                duration: 2e3,
                                icon: "../../images/cross.png"
                            });
                        }else if(newimg.width<700){
                            iosOverlay({
                                text: "图片太窄了",
                                duration: 2e3,
                                icon: "../../images/cross.png"
                            });
                        }
                    };
                    imgArr.push(imgUrl);
                    var $section = $("<section class='up-section fl loading'>");
                    imgContainer.prepend($section);
                    var $span = $("<span class='up-span'>");
                    $span.appendTo($section);
                    var $img0 = $("<img class='close-upimg'>").on("click",function(event){
                        event.preventDefault();
                        event.stopPropagation();
                        $(".works-mask").show();
                        delParent = $(this).parent();
                    });
                    $img0.attr("src","/images/delete_tu.png").appendTo($section);
                    var $img = $("<img class='up-img up-opcity'>");
                    $img.attr("src",imgArr[i]);
                    $img.appendTo($section);
                }
            }
            setTimeout(function(){
                $(".up-section").removeClass("loading");
                $(".up-img").removeClass("up-opcity");
            },450);
            numUp = imgContainer.find(".up-section").length;
            if(numUp >= 1){
                $(this).parent().hide();
            }
        });
        $(document).on("change","#shi03",function () {
            var fileval=this.files[0];
            var formData= new FormData();
            formData.append("image",fileval);
            console.log(formData);
            if(!$(this).prop("oldimg")){
                $(this).prop("oldimg",$(".desc3").val())
                console.log($(this).prop("oldimg"))
            }
            var thisimg=this;
            $.ajax({
                url: "{:url('/admin/goods/pictureHandle')}",
                type: "post",
                data: formData,
                contentType: false,
                processData: false,
                mimeType: "multipart/form-data",
                success: function (data) {
                    data= data.replace(/\\\\/g ,"\\" );
                    data=data.replace(/\"/g,"");
                    var id=$(".descimgid").get(2).value?$(".descimgid").get(2).value:"new";
                    var imgdescidpath=`${id};${data}`;

                    $($(".det").get(2)).val(imgdescidpath);
                },
                error: function (data) {
                    console.log(data);
                }
            });
            var idFile = $(this).attr("id");
            var file = document.getElementById(idFile);
            var imgContainer = $(this).parents(".z_photo"); //存放图片的父亲元素
            var fileList = file.files; //获取的图片文件
            var input = $(this).parent();//文本框的父亲元素
            var imgArr = [];
            //遍历得到的图片文件
            var numUp = imgContainer.find(".up-section").length;
            var totalNum = numUp + fileList.length;  //总的数量
            if(fileList.length > 1 || totalNum > 1 ){
                alert("上传图片数目不可以超过1个，请重新选择");  //一次选择上传超过1个 或者是已经上传和这次上传的到的总数也不可以超过5个
            }
            else if(numUp < 1){
                fileList = validateUp(fileList);
                for(var i = 0;i<fileList.length;i++){
                    var imgUrl = window.URL.createObjectURL(fileList[i]);
                    var newimg=new Image();
                    $(newimg).attr("src",imgUrl);
                    newimg.onload=function (){
                        console.log(newimg);
                        console.log(newimg.width,newimg.height);
                        if(newimg.width>800 ){
                            iosOverlay({
                                text: "图片太宽了",
                                duration: 2e3,
                                icon: "../../images/cross.png"
                            });
                        }else if(newimg.width<700){
                            iosOverlay({
                                text: "图片太窄了",
                                duration: 2e3,
                                icon: "../../images/cross.png"
                            });
                        }
                    };
                    imgArr.push(imgUrl);
                    var $section = $("<section class='up-section fl loading'>");
                    imgContainer.prepend($section);
                    var $span = $("<span class='up-span'>");
                    $span.appendTo($section);
                    var $img0 = $("<img class='close-upimg'>").on("click",function(event){
                        event.preventDefault();
                        event.stopPropagation();
                        $(".works-mask").show();
                        delParent = $(this).parent();
                    });
                    $img0.attr("src","/images/delete_tu.png").appendTo($section);
                    var $img = $("<img class='up-img up-opcity'>");
                    $img.attr("src",imgArr[i]);
                    $img.appendTo($section);
                }
            }
            setTimeout(function(){
                $(".up-section").removeClass("loading");
                $(".up-img").removeClass("up-opcity");
            },450);
            numUp = imgContainer.find(".up-section").length;
            if(numUp >= 1){
                $(this).parent().hide();
            }
        });
        $(document).on("change","#shi04",function () {
            var fileval=this.files[0];
            var formData= new FormData();
            formData.append("image",fileval);
            console.log(formData);
            if(!$(this).prop("oldimg")){
                $(this).prop("oldimg",$(".desc4").val())
                console.log($(this).prop("oldimg"))
            }
            var thisimg=this;
            $.ajax({
                url: "{:url('/admin/goods/pictureHandle')}",
                type: "post",
                data: formData,
                contentType: false,
                processData: false,
                mimeType: "multipart/form-data",
                success: function (data) {
                    data= data.replace(/\\\\/g ,"\\" );
                    data=data.replace(/\"/g,"");
                    var id=$(".descimgid").get(3).value?$(".descimgid").get(3).value:"new";
                    var imgdescidpath=`${id};${data}`;

                    $($(".det").get(3)).val(imgdescidpath);
                },
                error: function (data) {
                    console.log(data);
                }
            });
            var idFile = $(this).attr("id");
            var file = document.getElementById(idFile);
            var imgContainer = $(this).parents(".z_photo"); //存放图片的父亲元素
            var fileList = file.files; //获取的图片文件
            var input = $(this).parent();//文本框的父亲元素
            var imgArr = [];
            //遍历得到的图片文件
            var numUp = imgContainer.find(".up-section").length;
            var totalNum = numUp + fileList.length;  //总的数量
            if(fileList.length > 1 || totalNum > 1 ){
                alert("上传图片数目不可以超过1个，请重新选择");  //一次选择上传超过1个 或者是已经上传和这次上传的到的总数也不可以超过5个
            }
            else if(numUp < 1){
                fileList = validateUp(fileList);
                for(var i = 0;i<fileList.length;i++){
                    var imgUrl = window.URL.createObjectURL(fileList[i]);
                    var newimg=new Image();
                    $(newimg).attr("src",imgUrl);
                    newimg.onload=function (){
                        console.log(newimg);
                        console.log(newimg.width,newimg.height);
                        if(newimg.width>800 ){
                            iosOverlay({
                                text: "图片太宽了",
                                duration: 2e3,
                                icon: "../../images/cross.png"
                            });
                        }else if(newimg.width<700){
                            iosOverlay({
                                text: "图片太窄了",
                                duration: 2e3,
                                icon: "../../images/cross.png"
                            });
                        }
                    };
                    imgArr.push(imgUrl);
                    var $section = $("<section class='up-section fl loading'>");
                    imgContainer.prepend($section);
                    var $span = $("<span class='up-span'>");
                    $span.appendTo($section);
                    var $img0 = $("<img class='close-upimg'>").on("click",function(event){
                        event.preventDefault();
                        event.stopPropagation();
                        $(".works-mask").show();
                        delParent = $(this).parent();
                    });
                    $img0.attr("src","/images/delete_tu.png").appendTo($section);
                    var $img = $("<img class='up-img up-opcity'>");
                    $img.attr("src",imgArr[i]);
                    $img.appendTo($section);
                }
            }
            setTimeout(function(){
                $(".up-section").removeClass("loading");
                $(".up-img").removeClass("up-opcity");
            },450);
            numUp = imgContainer.find(".up-section").length;
            if(numUp >= 1){
                $(this).parent().hide();
            }
        });
        $(document).on("change","#shi05",function () {
            var fileval=this.files[0];
            var formData= new FormData();
            formData.append("image",fileval);
            console.log(formData);
            if(!$(this).prop("oldimg")){
                $(this).prop("oldimg",$(".desc5").val())
                console.log($(this).prop("oldimg"))
            }
            var thisimg=this;
            $.ajax({
                url: "{:url('/admin/goods/pictureHandle')}",
                type: "post",
                data: formData,
                contentType: false,
                processData: false,
                mimeType: "multipart/form-data",
                success: function (data) {
                    data= data.replace(/\\\\/g ,"\\" );
                    data=data.replace(/\"/g,"");
                    var id=$(".descimgid").get(4).value?$(".descimgid").get(4).value:"new";
                    var imgdescidpath=`${id};${data}`;
                    $($(".det").get(4)).val(imgdescidpath);
                },
                error: function (data) {
                    console.log(data);
                }
            });
            var idFile = $(this).attr("id");
            var file = document.getElementById(idFile);
            var imgContainer = $(this).parents(".z_photo"); //存放图片的父亲元素
            var fileList = file.files; //获取的图片文件
            var input = $(this).parent();//文本框的父亲元素
            var imgArr = [];
            //遍历得到的图片文件
            var numUp = imgContainer.find(".up-section").length;
            var totalNum = numUp + fileList.length;  //总的数量
            if(fileList.length > 1 || totalNum > 1 ){
                alert("上传图片数目不可以超过1个，请重新选择");  //一次选择上传超过1个 或者是已经上传和这次上传的到的总数也不可以超过5个
            }
            else if(numUp < 1){
                fileList = validateUp(fileList);
                for(var i = 0;i<fileList.length;i++){
                    var imgUrl = window.URL.createObjectURL(fileList[i]);
                    var newimg=new Image();
                    $(newimg).attr("src",imgUrl);
                    newimg.onload=function (){
                        console.log(newimg);
                        console.log(newimg.width,newimg.height);
                        if(newimg.width>800 ){
                            iosOverlay({
                                text: "图片太宽了",
                                duration: 2e3,
                                icon: "../../images/cross.png"
                            });
                        }else if(newimg.width<700){
                            iosOverlay({
                                text: "图片太窄了",
                                duration: 2e3,
                                icon: "../../images/cross.png"
                            });
                        }
                    };
                    imgArr.push(imgUrl);
                    var $section = $("<section class='up-section fl loading'>");
                    imgContainer.prepend($section);
                    var $span = $("<span class='up-span'>");
                    $span.appendTo($section);
                    var $img0 = $("<img class='close-upimg'>").on("click",function(event){
                        event.preventDefault();
                        event.stopPropagation();
                        $(".works-mask").show();
                        delParent = $(this).parent();
                    });
                    $img0.attr("src","/images/delete_tu.png").appendTo($section);
                    var $img = $("<img class='up-img up-opcity'>");
                    $img.attr("src",imgArr[i]);
                    $img.appendTo($section);
                }
            }
            setTimeout(function(){
                $(".up-section").removeClass("loading");
                $(".up-img").removeClass("up-opcity");
            },450);
            numUp = imgContainer.find(".up-section").length;
            if(numUp >= 1){
                $(this).parent().hide();
            }
        });
        $(document).on("change","#shi06",function () {
            var fileval=this.files[0];
            var formData= new FormData();
            formData.append("image",fileval);
            console.log(formData);
            if(!$(this).prop("oldimg")){
                $(this).prop("oldimg",$(".desc6").val())
                console.log($(this).prop("oldimg"))
            }
            var thisimg=this;
            $.ajax({
                url: "{:url('/admin/goods/pictureHandle')}",
                type: "post",
                data: formData,
                contentType: false,
                processData: false,
                mimeType: "multipart/form-data",
                success: function (data) {
                    data= data.replace(/\\\\/g ,"\\" );
                    data=data.replace(/\"/g,"");
                    var id=$(".descimgid").get(5).value?$(".descimgid").get(5).value:"new";
                    var imgdescidpath=`${id};${data}`;
                    $($(".det").get(5)).val(imgdescidpath);
                },
                error: function (data) {
                    console.log(data);
                }
            });
            var idFile = $(this).attr("id");
            var file = document.getElementById(idFile);
            var imgContainer = $(this).parents(".z_photo"); //存放图片的父亲元素
            var fileList = file.files; //获取的图片文件
            var input = $(this).parent();//文本框的父亲元素
            var imgArr = [];
            //遍历得到的图片文件
            var numUp = imgContainer.find(".up-section").length;
            var totalNum = numUp + fileList.length;  //总的数量
            if(fileList.length > 1 || totalNum > 1 ){
                alert("上传图片数目不可以超过1个，请重新选择");  //一次选择上传超过1个 或者是已经上传和这次上传的到的总数也不可以超过5个
            }
            else if(numUp < 1){
                fileList = validateUp(fileList);
                for(var i = 0;i<fileList.length;i++){
                    var imgUrl = window.URL.createObjectURL(fileList[i]);
                    var newimg=new Image();
                    $(newimg).attr("src",imgUrl);
                    newimg.onload=function (){
                        console.log(newimg);
                        console.log(newimg.width,newimg.height);
                        if(newimg.width>800 ){
                            iosOverlay({
                                text: "图片太宽了",
                                duration: 2e3,
                                icon: "../../images/cross.png"
                            });
                        }else if(newimg.width<700){
                            iosOverlay({
                                text: "图片太窄了",
                                duration: 2e3,
                                icon: "../../images/cross.png"
                            });
                        }
                    };
                    imgArr.push(imgUrl);
                    var $section = $("<section class='up-section fl loading'>");
                    imgContainer.prepend($section);
                    var $span = $("<span class='up-span'>");
                    $span.appendTo($section);
                    var $img0 = $("<img class='close-upimg'>").on("click",function(event){
                        event.preventDefault();
                        event.stopPropagation();
                        $(".works-mask").show();
                        delParent = $(this).parent();
                    });
                    $img0.attr("src","/images/delete_tu.png").appendTo($section);
                    var $img = $("<img class='up-img up-opcity'>");
                    $img.attr("src",imgArr[i]);
                    $img.appendTo($section);
                }
            }
            setTimeout(function(){
                $(".up-section").removeClass("loading");
                $(".up-img").removeClass("up-opcity");
            },450);
            numUp = imgContainer.find(".up-section").length;
            if(numUp >= 1){
                $(this).parent().hide();
            }
        });
        $(document).on("change","#shi07",function () {
            var fileval=this.files[0];
            var formData= new FormData();
            formData.append("image",fileval);
            console.log(formData);
            if(!$(this).prop("oldimg")){
                $(this).prop("oldimg",$(".desc7").val())
                console.log($(this).prop("oldimg"))
            }
            var thisimg=this;
            $.ajax({
                url: "{:url('/admin/goods/pictureHandle')}",
                type: "post",
                data: formData,
                contentType: false,
                processData: false,
                mimeType: "multipart/form-data",
                success: function (data) {
                    data= data.replace(/\\\\/g ,"\\" );
                    data=data.replace(/\"/g,"");
                    var id=$(".descimgid").get(6).value?$(".descimgid").get(6).value:"new";
                    var imgdescidpath=`${id};${data}`;
                    $($(".det").get(6)).val(imgdescidpath);
                },
                error: function (data) {
                    console.log(data);
                }
            });
            var idFile = $(this).attr("id");
            var file = document.getElementById(idFile);
            var imgContainer = $(this).parents(".z_photo"); //存放图片的父亲元素
            var fileList = file.files; //获取的图片文件
            var input = $(this).parent();//文本框的父亲元素
            var imgArr = [];
            //遍历得到的图片文件
            var numUp = imgContainer.find(".up-section").length;
            var totalNum = numUp + fileList.length;  //总的数量
            if(fileList.length > 1 || totalNum > 1 ){
                alert("上传图片数目不可以超过1个，请重新选择");  //一次选择上传超过1个 或者是已经上传和这次上传的到的总数也不可以超过5个
            }
            else if(numUp < 1){
                fileList = validateUp(fileList);
                for(var i = 0;i<fileList.length;i++){
                    var imgUrl = window.URL.createObjectURL(fileList[i]);
                    var newimg=new Image();
                    $(newimg).attr("src",imgUrl);
                    newimg.onload=function (){
                        console.log(newimg);
                        console.log(newimg.width,newimg.height);
                        if(newimg.width>800 ){
                            iosOverlay({
                                text: "图片太宽了",
                                duration: 2e3,
                                icon: "../../images/cross.png"
                            });
                        }else if(newimg.width<700){
                            iosOverlay({
                                text: "图片太窄了",
                                duration: 2e3,
                                icon: "../../images/cross.png"
                            });
                        }
                    };
                    imgArr.push(imgUrl);
                    var $section = $("<section class='up-section fl loading'>");
                    imgContainer.prepend($section);
                    var $span = $("<span class='up-span'>");
                    $span.appendTo($section);
                    var $img0 = $("<img class='close-upimg'>").on("click",function(event){
                        event.preventDefault();
                        event.stopPropagation();
                        $(".works-mask").show();
                        delParent = $(this).parent();
                    });
                    $img0.attr("src","/images/delete_tu.png").appendTo($section);
                    var $img = $("<img class='up-img up-opcity'>");
                    $img.attr("src",imgArr[i]);
                    $img.appendTo($section);
                }
            }
            setTimeout(function(){
                $(".up-section").removeClass("loading");
                $(".up-img").removeClass("up-opcity");
            },450);
            numUp = imgContainer.find(".up-section").length;
            if(numUp >= 1){
                $(this).parent().hide();
            }
        });
        $(document).on("change","#shi08",function () {
            var fileval=this.files[0];
            var formData= new FormData();
            formData.append("image",fileval);
            console.log(formData);
            if(!$(this).prop("oldimg")){
                $(this).prop("oldimg",$(".desc8").val())
                console.log($(this).prop("oldimg"))
            }
            var thisimg=this;
            $.ajax({
                url: "{:url('/admin/goods/pictureHandle')}",
                type: "post",
                data: formData,
                contentType: false,
                processData: false,
                mimeType: "multipart/form-data",
                success: function (data) {
                    data= data.replace(/\\\\/g ,"\\" );
                    data=data.replace(/\"/g,"");
                    var id=$(".descimgid").get(7).value?$(".descimgid").get(7).value:"new";
                    var imgdescidpath=`${id};${data}`;
                    $($(".det").get(7)).val(imgdescidpath);
                },
                error: function (data) {
                    console.log(data);
                }
            });
            var idFile = $(this).attr("id");
            var file = document.getElementById(idFile);
            var imgContainer = $(this).parents(".z_photo"); //存放图片的父亲元素
            var fileList = file.files; //获取的图片文件
            var input = $(this).parent();//文本框的父亲元素
            var imgArr = [];
            //遍历得到的图片文件
            var numUp = imgContainer.find(".up-section").length;
            var totalNum = numUp + fileList.length;  //总的数量
            if(fileList.length > 1 || totalNum > 1 ){
                alert("上传图片数目不可以超过1个，请重新选择");  //一次选择上传超过1个 或者是已经上传和这次上传的到的总数也不可以超过5个
            }
            else if(numUp < 1){
                fileList = validateUp(fileList);
                for(var i = 0;i<fileList.length;i++){
                    var imgUrl = window.URL.createObjectURL(fileList[i]);
                    var newimg=new Image();
                    $(newimg).attr("src",imgUrl);
                    newimg.onload=function (){
                        console.log(newimg);
                        console.log(newimg.width,newimg.height);
                        if(newimg.width>800 ){
                            iosOverlay({
                                text: "图片太宽了",
                                duration: 2e3,
                                icon: "../../images/cross.png"
                            });
                        }else if(newimg.width<700){
                            iosOverlay({
                                text: "图片太窄了",
                                duration: 2e3,
                                icon: "../../images/cross.png"
                            });
                        }
                    };
                    imgArr.push(imgUrl);
                    var $section = $("<section class='up-section fl loading'>");
                    imgContainer.prepend($section);
                    var $span = $("<span class='up-span'>");
                    $span.appendTo($section);
                    var $img0 = $("<img class='close-upimg'>").on("click",function(event){
                        event.preventDefault();
                        event.stopPropagation();
                        $(".works-mask").show();
                        delParent = $(this).parent();
                    });
                    $img0.attr("src","/images/delete_tu.png").appendTo($section);
                    var $img = $("<img class='up-img up-opcity'>");
                    $img.attr("src",imgArr[i]);
                    $img.appendTo($section);
                }
            }
            setTimeout(function(){
                $(".up-section").removeClass("loading");
                $(".up-img").removeClass("up-opcity");
            },450);
            numUp = imgContainer.find(".up-section").length;
            if(numUp >= 1){
                $(this).parent().hide();
            }
        });
        $(document).on("change","#shi09",function () {
            var fileval=this.files[0];
            var formData= new FormData();
            formData.append("image",fileval);
            console.log(formData);
            if(!$(this).prop("oldimg")){
                $(this).prop("oldimg",$(".desc9").val())
                console.log($(this).prop("oldimg"))
            }
            var thisimg=this;
            $.ajax({
                url: "{:url('/admin/goods/pictureHandle')}",
                type: "post",
                data: formData,
                contentType: false,
                processData: false,
                mimeType: "multipart/form-data",
                success: function (data) {
                    data= data.replace(/\\\\/g ,"\\" );
                    data=data.replace(/\"/g,"");
                    var id=$(".descimgid").get(8).value?$(".descimgid").get(8).value:"new";
                    var imgdescidpath=`${id};${data}`;
                    $($(".det").get(8)).val(imgdescidpath);
                },
                error: function (data) {
                    console.log(data);
                }
            });
            var idFile = $(this).attr("id");
            var file = document.getElementById(idFile);
            var imgContainer = $(this).parents(".z_photo"); //存放图片的父亲元素
            var fileList = file.files; //获取的图片文件
            var input = $(this).parent();//文本框的父亲元素
            var imgArr = [];
            //遍历得到的图片文件
            var numUp = imgContainer.find(".up-section").length;
            var totalNum = numUp + fileList.length;  //总的数量
            if(fileList.length > 1 || totalNum > 1 ){
                alert("上传图片数目不可以超过1个，请重新选择");  //一次选择上传超过1个 或者是已经上传和这次上传的到的总数也不可以超过5个
            }
            else if(numUp < 1){
                fileList = validateUp(fileList);
                for(var i = 0;i<fileList.length;i++){
                    var imgUrl = window.URL.createObjectURL(fileList[i]);
                    var newimg=new Image();
                    $(newimg).attr("src",imgUrl);
                    newimg.onload=function (){
                        console.log(newimg);
                        console.log(newimg.width,newimg.height);
                        if(newimg.width>800 ){
                            iosOverlay({
                                text: "图片太宽了",
                                duration: 2e3,
                                icon: "../../images/cross.png"
                            });
                        }else if(newimg.width<700){
                            iosOverlay({
                                text: "图片太窄了",
                                duration: 2e3,
                                icon: "../../images/cross.png"
                            });
                        }
                    };
                    imgArr.push(imgUrl);
                    var $section = $("<section class='up-section fl loading'>");
                    imgContainer.prepend($section);
                    var $span = $("<span class='up-span'>");
                    $span.appendTo($section);
                    var $img0 = $("<img class='close-upimg'>").on("click",function(event){
                        event.preventDefault();
                        event.stopPropagation();
                        $(".works-mask").show();
                        delParent = $(this).parent();
                    });
                    $img0.attr("src","/images/delete_tu.png").appendTo($section);
                    var $img = $("<img class='up-img up-opcity'>");
                    $img.attr("src",imgArr[i]);
                    $img.appendTo($section);
                }
            }
            setTimeout(function(){
                $(".up-section").removeClass("loading");
                $(".up-img").removeClass("up-opcity");
            },450);
            numUp = imgContainer.find(".up-section").length;
            if(numUp >= 1){
                $(this).parent().hide();
            }
        });
        $(document).on("change","#shi10",function () {
            var fileval=this.files[0];
            var formData= new FormData();
            formData.append("image",fileval);
            console.log(formData);
            if(!$(this).prop("oldimg")){
                $(this).prop("oldimg",$(".desc10").val())
                console.log($(this).prop("oldimg"))
            }
            var thisimg=this;
            $.ajax({
                url: "{:url('/admin/goods/pictureHandle')}",
                type: "post",
                data: formData,
                contentType: false,
                processData: false,
                mimeType: "multipart/form-data",
                success: function (data) {
                    data= data.replace(/\\\\/g ,"\\" );
                    data=data.replace(/\"/g,"");
                    var id=$(".descimgid").get(9).value?$(".descimgid").get(9).value:"new";
                    var imgdescidpath=`${id};${data}`;
                    $($(".det").get(9)).val(imgdescidpath);
                },
                error: function (data) {
                    console.log(data);
                }
            });
            var idFile = $(this).attr("id");
            var file = document.getElementById(idFile);
            var imgContainer = $(this).parents(".z_photo"); //存放图片的父亲元素
            var fileList = file.files; //获取的图片文件
            var input = $(this).parent();//文本框的父亲元素
            var imgArr = [];
            //遍历得到的图片文件
            var numUp = imgContainer.find(".up-section").length;
            var totalNum = numUp + fileList.length;  //总的数量
            if(fileList.length > 1 || totalNum > 1 ){
                alert("上传图片数目不可以超过1个，请重新选择");  //一次选择上传超过1个 或者是已经上传和这次上传的到的总数也不可以超过5个
            }
            else if(numUp < 1){
                fileList = validateUp(fileList);
                for(var i = 0;i<fileList.length;i++){
                    var imgUrl = window.URL.createObjectURL(fileList[i]);
                    var newimg=new Image();
                    $(newimg).attr("src",imgUrl);
                    newimg.onload=function (){
                        console.log(newimg);
                        console.log(newimg.width,newimg.height);
                        if(newimg.width>800 ){
                            iosOverlay({
                                text: "图片太宽了",
                                duration: 2e3,
                                icon: "../../images/cross.png"
                            });
                        }else if(newimg.width<700){
                            iosOverlay({
                                text: "图片太窄了",
                                duration: 2e3,
                                icon: "../../images/cross.png"
                            });
                        }
                    };
                    imgArr.push(imgUrl);
                    var $section = $("<section class='up-section fl loading'>");
                    imgContainer.prepend($section);
                    var $span = $("<span class='up-span'>");
                    $span.appendTo($section);
                    var $img0 = $("<img class='close-upimg'>").on("click",function(event){
                        event.preventDefault();
                        event.stopPropagation();
                        $(".works-mask").show();
                        delParent = $(this).parent();
                    });
                    $img0.attr("src","/images/delete_tu.png").appendTo($section);
                    var $img = $("<img class='up-img up-opcity'>");
                    $img.attr("src",imgArr[i]);
                    $img.appendTo($section);
                }
            }
            setTimeout(function(){
                $(".up-section").removeClass("loading");
                $(".up-img").removeClass("up-opcity");
            },450);
            numUp = imgContainer.find(".up- section").length;
            if(numUp >= 1){
                $(this).parent().hide();
            }
        });
        $(document).on("change","#shi11",function () {
            var fileval=this.files[0];
            var formData= new FormData();
            formData.append("image",fileval);
            console.log(formData);
            if(!$(this).prop("oldimg")){
                $(this).prop("oldimg",$(".desc11").val())
                console.log($(this).prop("oldimg"))
            }
            var thisimg=this;
            $.ajax({
                url: "{:url('/admin/goods/pictureHandle')}",
                type: "post",
                data: formData,
                contentType: false,
                processData: false,
                mimeType: "multipart/form-data",
                success: function (data) {
                    data= data.replace(/\\\\/g ,"\\" );
                    data=data.replace(/\"/g,"");
                    var id=$(".descimgid").get(10).value?$(".descimgid").get(10).value:"new";
                    var imgdescidpath=`${id};${data}`;
                    $($(".det").get(10)).val(imgdescidpath);
                },
                error: function (data) {
                    console.log(data);
                }
            });
            var idFile = $(this).attr("id");
            var file = document.getElementById(idFile);
            var imgContainer = $(this).parents(".z_photo"); //存放图片的父亲元素
            var fileList = file.files; //获取的图片文件
            var input = $(this).parent();//文本框的父亲元素
            var imgArr = [];
            //遍历得到的图片文件
            var numUp = imgContainer.find(".up-section").length;
            var totalNum = numUp + fileList.length;  //总的数量
            if(fileList.length > 1 || totalNum > 1 ){
                alert("上传图片数目不可以超过1个，请重新选择");  //一次选择上传超过1个 或者是已经上传和这次上传的到的总数也不可以超过5个
            }
            else if(numUp < 1){
                fileList = validateUp(fileList);
                for(var i = 0;i<fileList.length;i++){
                    var imgUrl = window.URL.createObjectURL(fileList[i]);
                    var newimg=new Image();
                    $(newimg).attr("src",imgUrl);
                    newimg.onload=function (){
                        console.log(newimg);
                        console.log(newimg.width,newimg.height);
                        if(newimg.width>800 ){
                            iosOverlay({
                                text: "图片太宽了",
                                duration: 2e3,
                                icon: "../../images/cross.png"
                            });
                        }else if(newimg.width<700){
                            iosOverlay({
                                text: "图片太窄了",
                                duration: 2e3,
                                icon: "../../images/cross.png"
                            });
                        }
                    };
                    imgArr.push(imgUrl);
                    var $section = $("<section class='up-section fl loading'>");
                    imgContainer.prepend($section);
                    var $span = $("<span class='up-span'>");
                    $span.appendTo($section);
                    var $img0 = $("<img class='close-upimg'>").on("click",function(event){
                        event.preventDefault();
                        event.stopPropagation();
                        $(".works-mask").show();
                        delParent = $(this).parent();
                    });
                    $img0.attr("src","/images/delete_tu.png").appendTo($section);
                    var $img = $("<img class='up-img up-opcity'>");
                    $img.attr("src",imgArr[i]);
                    $img.appendTo($section);
                }
            }
            setTimeout(function(){
                $(".up-section").removeClass("loading");
                $(".up-img").removeClass("up-opcity");
            },450);
            numUp = imgContainer.find(".up-section").length;
            if(numUp >= 1){
                $(this).parent().hide();
            }
        });
        $(document).on("change","#shi12",function () {
            var fileval=this.files[0];
            var formData= new FormData();
            formData.append("image",fileval);
            console.log(formData);
            if(!$(this).prop("oldimg")){
                $(this).prop("oldimg",$(".desc12").val())
                console.log($(this).prop("oldimg"))
            }
            var thisimg=this;
            $.ajax({
                url: "{:url('/admin/goods/pictureHandle')}",
                type: "post",
                data: formData,
                contentType: false,
                processData: false,
                mimeType: "multipart/form-data",
                success: function (data) {
                    data= data.replace(/\\\\/g ,"\\" );
                    data=data.replace(/\"/g,"");
                    var id=$(".descimgid").get(11).value?$(".descimgid").get(11).value:"new";
                    var imgdescidpath=`${id};${data}`;
                    $($(".det").get(11)).val(imgdescidpath);
                },
                error: function (data) {
                    console.log(data);
                }
            });
            var idFile = $(this).attr("id");
            var file = document.getElementById(idFile);
            var imgContainer = $(this).parents(".z_photo"); //存放图片的父亲元素
            var fileList = file.files; //获取的图片文件
            var input = $(this).parent();//文本框的父亲元素
            var imgArr = [];
            //遍历得到的图片文件
            var numUp = imgContainer.find(".up-section").length;
            var totalNum = numUp + fileList.length;  //总的数量
            if(fileList.length > 1 || totalNum > 1 ){
                alert("上传图片数目不可以超过1个，请重新选择");  //一次选择上传超过1个 或者是已经上传和这次上传的到的总数也不可以超过5个
            }
            else if(numUp < 1){
                fileList = validateUp(fileList);
                for(var i = 0;i<fileList.length;i++){
                    var imgUrl = window.URL.createObjectURL(fileList[i]);
                    var newimg=new Image();
                    $(newimg).attr("src",imgUrl);
                    newimg.onload=function (){
                        console.log(newimg);
                        console.log(newimg.width,newimg.height);
                        if(newimg.width>800 ){
                            iosOverlay({
                                text: "图片太宽了",
                                duration: 2e3,
                                icon: "../../images/cross.png"
                            });
                        }else if(newimg.width<700){
                            iosOverlay({
                                text: "图片太窄了",
                                duration: 2e3,
                                icon: "../../images/cross.png"
                            });
                        }
                    };
                    imgArr.push(imgUrl);
                    var $section = $("<section class='up-section fl loading'>");
                    imgContainer.prepend($section);
                    var $span = $("<span class='up-span'>");
                    $span.appendTo($section);
                    var $img0 = $("<img class='close-upimg'>").on("click",function(event){
                        event.preventDefault();
                        event.stopPropagation();
                        $(".works-mask").show();
                        delParent = $(this).parent();
                    });
                    $img0.attr("src","/images/delete_tu.png").appendTo($section);
                    var $img = $("<img class='up-img up-opcity'>");
                    $img.attr("src",imgArr[i]);
                    $img.appendTo($section);
                }
            }
            setTimeout(function(){
                $(".up-section").removeClass("loading");
                $(".up-img").removeClass("up-opcity");
            },450);
            numUp = imgContainer.find(".up-section").length;
            if(numUp >= 1){
                $(this).parent().hide();
            }
        });
        $(document).on("change","#shi13",function () {
            var fileval=this.files[0];
            var formData= new FormData();
            formData.append("image",fileval);
            console.log(formData);
            if(!$(this).prop("oldimg")){
                $(this).prop("oldimg",$(".desc13").val())
                console.log($(this).prop("oldimg"))
            }
            var thisimg=this;
            $.ajax({
                url: "{:url('/admin/goods/pictureHandle')}",
                type: "post",
                data: formData,
                contentType: false,
                processData: false,
                mimeType: "multipart/form-data",
                success: function (data) {
                    data= data.replace(/\\\\/g ,"\\" );
                    data=data.replace(/\"/g,"");
                    var id=$(".descimgid").get(12).value?$(".descimgid").get(12).value:"new";
                    var imgdescidpath=`${id};${data}`;
                    $($(".det").get(12)).val(imgdescidpath);
                },
                error: function (data) {
                    console.log(data);
                }
            });
            var idFile = $(this).attr("id");
            var file = document.getElementById(idFile);
            var imgContainer = $(this).parents(".z_photo"); //存放图片的父亲元素
            var fileList = file.files; //获取的图片文件
            var input = $(this).parent();//文本框的父亲元素
            var imgArr = [];
            //遍历得到的图片文件
            var numUp = imgContainer.find(".up-section").length;
            var totalNum = numUp + fileList.length;  //总的数量
            if(fileList.length > 1 || totalNum > 1 ){
                alert("上传图片数目不可以超过1个，请重新选择");  //一次选择上传超过1个 或者是已经上传和这次上传的到的总数也不可以超过5个
            }
            else if(numUp < 1){
                fileList = validateUp(fileList);
                for(var i = 0;i<fileList.length;i++){
                    var imgUrl = window.URL.createObjectURL(fileList[i]);
                    var newimg=new Image();
                    $(newimg).attr("src",imgUrl);
                    newimg.onload=function (){
                        console.log(newimg);
                        console.log(newimg.width,newimg.height);
                        if(newimg.width>800 ){
                            iosOverlay({
                                text: "图片太宽了",
                                duration: 2e3,
                                icon: "../../images/cross.png"
                            });
                        }else if(newimg.width<700){
                            iosOverlay({
                                text: "图片太窄了",
                                duration: 2e3,
                                icon: "../../images/cross.png"
                            });
                        }
                    };
                    imgArr.push(imgUrl);
                    var $section = $("<section class='up-section fl loading'>");
                    imgContainer.prepend($section);
                    var $span = $("<span class='up-span'>");
                    $span.appendTo($section);
                    var $img0 = $("<img class='close-upimg'>").on("click",function(event){
                        event.preventDefault();
                        event.stopPropagation();
                        $(".works-mask").show();
                        delParent = $(this).parent();
                    });
                    $img0.attr("src","/images/delete_tu.png").appendTo($section);
                    var $img = $("<img class='up-img up-opcity'>");
                    $img.attr("src",imgArr[i]);
                    $img.appendTo($section);
                }
            }
            setTimeout(function(){
                $(".up-section").removeClass("loading");
                $(".up-img").removeClass("up-opcity");
            },450);
            numUp = imgContainer.find(".up-section").length;
            if(numUp >= 1){
                $(this).parent().hide();
            }
        });
        $(document).on("change","#shi14",function () {
            var fileval=this.files[0];
            var formData= new FormData();
            formData.append("image",fileval);
            console.log(formData);
            if(!$(this).prop("oldimg")){
                $(this).prop("oldimg",$(".desc14").val())
                console.log($(this).prop("oldimg"))
            }
            var thisimg=this;
            $.ajax({
                url: "{:url('/admin/goods/pictureHandle')}",
                type: "post",
                data: formData,
                contentType: false,
                processData: false,
                mimeType: "multipart/form-data",
                success: function (data) {
                    data= data.replace(/\\\\/g ,"\\" );
                    data=data.replace(/\"/g,"");
                    var id=$(".descimgid").get(13).value?$(".descimgid").get(13).value:"new";
                    var imgdescidpath=`${id};${data}`;
                    $($(".det").get(13)).val(imgdescidpath);
                },
                error: function (data) {
                    console.log(data);
                }
            });
            var idFile = $(this).attr("id");
            var file = document.getElementById(idFile);
            var imgContainer = $(this).parents(".z_photo"); //存放图片的父亲元素
            var fileList = file.files; //获取的图片文件
            var input = $(this).parent();//文本框的父亲元素
            var imgArr = [];
            //遍历得到的图片文件
            var numUp = imgContainer.find(".up-section").length;
            var totalNum = numUp + fileList.length;  //总的数量
            if(fileList.length > 1 || totalNum > 1 ){
                alert("上传图片数目不可以超过1个，请重新选择");  //一次选择上传超过1个 或者是已经上传和这次上传的到的总数也不可以超过5个
            }
            else if(numUp < 1){
                fileList = validateUp(fileList);
                for(var i = 0;i<fileList.length;i++){
                    var imgUrl = window.URL.createObjectURL(fileList[i]);
                    var newimg=new Image();
                    $(newimg).attr("src",imgUrl);
                    newimg.onload=function (){
                        console.log(newimg);
                        console.log(newimg.width,newimg.height);
                        if(newimg.width>800 ){
                            iosOverlay({
                                text: "图片太宽了",
                                duration: 2e3,
                                icon: "../../images/cross.png"
                            });
                        }else if(newimg.width<700){
                            iosOverlay({
                                text: "图片太窄了",
                                duration: 2e3,
                                icon: "../../images/cross.png"
                            });
                        }
                    };
                    imgArr.push(imgUrl);
                    var $section = $("<section class='up-section fl loading'>");
                    imgContainer.prepend($section);
                    var $span = $("<span class='up-span'>");
                    $span.appendTo($section);
                    var $img0 = $("<img class='close-upimg'>").on("click",function(event){
                        event.preventDefault();
                        event.stopPropagation();
                        $(".works-mask").show();
                        delParent = $(this).parent();
                    });
                    $img0.attr("src","/images/delete_tu.png").appendTo($section);
                    var $img = $("<img class='up-img up-opcity'>");
                    $img.attr("src",imgArr[i]);
                    $img.appendTo($section);
                }
            }
            setTimeout(function(){
                $(".up-section").removeClass("loading");
                $(".up-img").removeClass("up-opcity");
            },450);
            numUp = imgContainer.find(".up-section").length;
            if(numUp >= 1){
                $(this).parent().hide();
            }
        });
        $(document).on("change","#shi15",function () {
            var fileval=this.files[0];
            var formData= new FormData();
            formData.append("image",fileval);
            console.log(formData);
            if(!$(this).prop("oldimg")){
                $(this).prop("oldimg",$(".desc15").val())
                console.log($(this).prop("oldimg"))
            }
            var thisimg=this;
            $.ajax({
                url: "{:url('/admin/goods/pictureHandle')}",
                type: "post",
                data: formData,
                contentType: false,
                processData: false,
                mimeType: "multipart/form-data",
                success: function (data) {
                    data= data.replace(/\\\\/g ,"\\" );
                    data=data.replace(/\"/g,"");
                    var id=$(".descimgid").get(14).value?$(".descimgid").get(14).value:"new";
                    var imgdescidpath=`${id};${data}`;
                    $($(".det").get(14)).val(imgdescidpath);
                },
                error: function (data) {
                    console.log(data);
                }
            });
            var idFile = $(this).attr("id");
            var file = document.getElementById(idFile);
            var imgContainer = $(this).parents(".z_photo"); //存放图片的父亲元素
            var fileList = file.files; //获取的图片文件
            var input = $(this).parent();//文本框的父亲元素
            var imgArr = [];
            //遍历得到的图片文件
            var numUp = imgContainer.find(".up-section").length;
            var totalNum = numUp + fileList.length;  //总的数量
            if(fileList.length > 1 || totalNum > 1 ){
                alert("上传图片数目不可以超过1个，请重新选择");  //一次选择上传超过1个 或者是已经上传和这次上传的到的总数也不可以超过5个
            }
            else if(numUp < 1){
                fileList = validateUp(fileList);
                for(var i = 0;i<fileList.length;i++){
                    var imgUrl = window.URL.createObjectURL(fileList[i]);
                    var newimg=new Image();
                    $(newimg).attr("src",imgUrl);
                    newimg.onload=function (){
                        console.log(newimg);
                        console.log(newimg.width,newimg.height);
                        if(newimg.width>800 ){
                            iosOverlay({
                                text: "图片太宽了",
                                duration: 2e3,
                                icon: "../../images/cross.png"
                            });
                        }else if(newimg.width<700){
                            iosOverlay({
                                text: "图片太窄了",
                                duration: 2e3,
                                icon: "../../images/cross.png"
                            });
                        }
                    };
                    imgArr.push(imgUrl);
                    var $section = $("<section class='up-section fl loading'>");
                    imgContainer.prepend($section);
                    var $span = $("<span class='up-span'>");
                    $span.appendTo($section);
                    var $img0 = $("<img class='close-upimg'>").on("click",function(event){
                        event.preventDefault();
                        event.stopPropagation();
                        $(".works-mask").show();
                        delParent = $(this).parent();
                    });
                    $img0.attr("src","/images/delete_tu.png").appendTo($section);
                    var $img = $("<img class='up-img up-opcity'>");
                    $img.attr("src",imgArr[i]);
                    $img.appendTo($section);
                }
            }
            setTimeout(function(){
                $(".up-section").removeClass("loading");
                $(".up-img").removeClass("up-opcity");
            },450);
            numUp = imgContainer.find(".up-section").length;
            if(numUp >= 1){
                $(this).parent().hide();
            }
        });
        $(document).on("change","#shi16",function () {
            var fileval=this.files[0];
            var formData= new FormData();
            formData.append("image",fileval);
            console.log(formData);
            if(!$(this).prop("oldimg")){
                $(this).prop("oldimg",$(".desc16").val())
                console.log($(this).prop("oldimg"))
            }
            var thisimg=this;
            $.ajax({
                url: "{:url('/admin/goods/pictureHandle')}",
                type: "post",
                data: formData,
                contentType: false,
                processData: false,
                mimeType: "multipart/form-data",
                success: function (data) {
                    data= data.replace(/\\\\/g ,"\\" );
                    data=data.replace(/\"/g,"");
                    var id=$(".descimgid").get(15).value?$(".descimgid").get(15).value:"new";
                    var imgdescidpath=`${id};${data}`;
                    $($(".det").get(15)).val(imgdescidpath);
                },
                error: function (data) {
                    console.log(data);
                }
            });
            var idFile = $(this).attr("id");
            var file = document.getElementById(idFile);
            var imgContainer = $(this).parents(".z_photo"); //存放图片的父亲元素
            var fileList = file.files; //获取的图片文件
            var input = $(this).parent();//文本框的父亲元素
            var imgArr = [];
            //遍历得到的图片文件
            var numUp = imgContainer.find(".up-section").length;
            var totalNum = numUp + fileList.length;  //总的数量
            if(fileList.length > 1 || totalNum > 1 ){
                alert("上传图片数目不可以超过1个，请重新选择");  //一次选择上传超过1个 或者是已经上传和这次上传的到的总数也不可以超过5个
            }
            else if(numUp < 1){
                fileList = validateUp(fileList);
                for(var i = 0;i<fileList.length;i++){
                    var imgUrl = window.URL.createObjectURL(fileList[i]);
                    var newimg=new Image();
                    $(newimg).attr("src",imgUrl);
                    newimg.onload=function (){
                        console.log(newimg);
                        console.log(newimg.width,newimg.height);
                        if(newimg.width>800 ){
                            iosOverlay({
                                text: "图片太宽了",
                                duration: 2e3,
                                icon: "../../images/cross.png"
                            });
                        }else if(newimg.width<700){
                            iosOverlay({
                                text: "图片太窄了",
                                duration: 2e3,
                                icon: "../../images/cross.png"
                            });
                        }
                    };
                    imgArr.push(imgUrl);
                    var $section = $("<section class='up-section fl loading'>");
                    imgContainer.prepend($section);
                    var $span = $("<span class='up-span'>");
                    $span.appendTo($section);
                    var $img0 = $("<img class='close-upimg'>").on("click",function(event){
                        event.preventDefault();
                        event.stopPropagation();
                        $(".works-mask").show();
                        delParent = $(this).parent();
                    });
                    $img0.attr("src","/images/delete_tu.png").appendTo($section);
                    var $img = $("<img class='up-img up-opcity'>");
                    $img.attr("src",imgArr[i]);
                    $img.appendTo($section);
                }
            }
            setTimeout(function(){
                $(".up-section").removeClass("loading");
                $(".up-img").removeClass("up-opcity");
            },450);
            numUp = imgContainer.find(".up-section").length;
            if(numUp >= 1){
                $(this).parent().hide();
            }
        });
        $(document).on("change","#shi17",function () {
            var fileval=this.files[0];
            var formData= new FormData();
            formData.append("image",fileval);
            console.log(formData);
            if(!$(this).prop("oldimg")){
                $(this).prop("oldimg",$(".desc17").val())
                console.log($(this).prop("oldimg"))
            }
            var thisimg=this;
            $.ajax({
                url: "{:url('/admin/goods/pictureHandle')}",
                type: "post",
                data: formData,
                contentType: false,
                processData: false,
                mimeType: "multipart/form-data",
                success: function (data) {
                    data= data.replace(/\\\\/g ,"\\" );
                    data=data.replace(/\"/g,"");
                    var id=$(".descimgid").get(16).value?$(".descimgid").get(16).value:"new";
                    var imgdescidpath=`${id};${data}`;
                    $($(".det").get(16)).val(imgdescidpath);
                },
                error: function (data) {
                    console.log(data);
                }
            });
            var idFile = $(this).attr("id");
            var file = document.getElementById(idFile);
            var imgContainer = $(this).parents(".z_photo"); //存放图片的父亲元素
            var fileList = file.files; //获取的图片文件
            var input = $(this).parent();//文本框的父亲元素
            var imgArr = [];
            //遍历得到的图片文件
            var numUp = imgContainer.find(".up-section").length;
            var totalNum = numUp + fileList.length;  //总的数量
            if(fileList.length > 1 || totalNum > 1 ){
                alert("上传图片数目不可以超过1个，请重新选择");  //一次选择上传超过1个 或者是已经上传和这次上传的到的总数也不可以超过5个
            }
            else if(numUp < 1){
                fileList = validateUp(fileList);
                for(var i = 0;i<fileList.length;i++){
                    var imgUrl = window.URL.createObjectURL(fileList[i]);
                    var newimg=new Image();
                    $(newimg).attr("src",imgUrl);
                    newimg.onload=function (){
                        console.log(newimg);
                        console.log(newimg.width,newimg.height);
                        if(newimg.width>800 ){
                            iosOverlay({
                                text: "图片太宽了",
                                duration: 2e3,
                                icon: "../../images/cross.png"
                            });
                        }else if(newimg.width<700){
                            iosOverlay({
                                text: "图片太窄了",
                                duration: 2e3,
                                icon: "../../images/cross.png"
                            });
                        }
                    };
                    imgArr.push(imgUrl);
                    var $section = $("<section class='up-section fl loading'>");
                    imgContainer.prepend($section);
                    var $span = $("<span class='up-span'>");
                    $span.appendTo($section);
                    var $img0 = $("<img class='close-upimg'>").on("click",function(event){
                        event.preventDefault();
                        event.stopPropagation();
                        $(".works-mask").show();
                        delParent = $(this).parent();
                    });
                    $img0.attr("src","/images/delete_tu.png").appendTo($section);
                    var $img = $("<img class='up-img up-opcity'>");
                    $img.attr("src",imgArr[i]);
                    $img.appendTo($section);
                }
            }
            setTimeout(function(){
                $(".up-section").removeClass("loading");
                $(".up-img").removeClass("up-opcity");
            },450);
            numUp = imgContainer.find(".up-section").length;
            if(numUp >= 1){
                $(this).parent().hide();
            }
        });
        $(document).on("change","#shi18",function () {
            var fileval=this.files[0];
            var formData= new FormData();
            formData.append("image",fileval);
            console.log(formData);
            if(!$(this).prop("oldimg")){
                $(this).prop("oldimg",$(".desc18").val())
                console.log($(this).prop("oldimg"))
            }
            var thisimg=this;
            $.ajax({
                url: "{:url('/admin/goods/pictureHandle')}",
                type: "post",
                data: formData,
                contentType: false,
                processData: false,
                mimeType: "multipart/form-data",
                success: function (data) {
                    data= data.replace(/\\\\/g ,"\\" );
                    data=data.replace(/\"/g,"");
                    var id=$(".descimgid").get(17).value?$(".descimgid").get(17).value:"new";
                    var imgdescidpath=`${id};${data}`;
                    $($(".det").get(17)).val(imgdescidpath);
                },
                error: function (data) {
                    console.log(data);
                }
            });
            var idFile = $(this).attr("id");
            var file = document.getElementById(idFile);
            var imgContainer = $(this).parents(".z_photo"); //存放图片的父亲元素
            var fileList = file.files; //获取的图片文件
            var input = $(this).parent();//文本框的父亲元素
            var imgArr = [];
            //遍历得到的图片文件
            var numUp = imgContainer.find(".up-section").length;
            var totalNum = numUp + fileList.length;  //总的数量
            if(fileList.length > 1 || totalNum > 1 ){
                alert("上传图片数目不可以超过1个，请重新选择");  //一次选择上传超过1个 或者是已经上传和这次上传的到的总数也不可以超过5个
            }
            else if(numUp < 1){
                fileList = validateUp(fileList);
                for(var i = 0;i<fileList.length;i++){
                    var imgUrl = window.URL.createObjectURL(fileList[i]);
                    var newimg=new Image();
                    $(newimg).attr("src",imgUrl);
                    newimg.onload=function (){
                        console.log(newimg);
                        console.log(newimg.width,newimg.height);
                        if(newimg.width>800 ){
                            iosOverlay({
                                text: "图片太宽了",
                                duration: 2e3,
                                icon: "../../images/cross.png"
                            });
                        }else if(newimg.width<700){
                            iosOverlay({
                                text: "图片太窄了",
                                duration: 2e3,
                                icon: "../../images/cross.png"
                            });
                        }
                    };
                    imgArr.push(imgUrl);
                    var $section = $("<section class='up-section fl loading'>");
                    imgContainer.prepend($section);
                    var $span = $("<span class='up-span'>");
                    $span.appendTo($section);
                    var $img0 = $("<img class='close-upimg'>").on("click",function(event){
                        event.preventDefault();
                        event.stopPropagation();
                        $(".works-mask").show();
                        delParent = $(this).parent();
                    });
                    $img0.attr("src","/images/delete_tu.png").appendTo($section);
                    var $img = $("<img class='up-img up-opcity'>");
                    $img.attr("src",imgArr[i]);
                    $img.appendTo($section);
                }
            }
            setTimeout(function(){
                $(".up-section").removeClass("loading");
                $(".up-img").removeClass("up-opcity");
            },450);
            numUp = imgContainer.find(".up-section").length;
            if(numUp >= 1){
                $(this).parent().hide();
            }
        });
        $(document).on("change","#shi19",function () {
            var fileval=this.files[0];
            var formData= new FormData();
            formData.append("image",fileval);
            console.log(formData);
            if(!$(this).prop("oldimg")){
                $(this).prop("oldimg",$(".desc19").val())
                console.log($(this).prop("oldimg"))
            }
            var thisimg=this;
            $.ajax({
                url: "{:url('/admin/goods/pictureHandle')}",
                type: "post",
                data: formData,
                contentType: false,
                processData: false,
                mimeType: "multipart/form-data",
                success: function (data) {
                    data= data.replace(/\\\\/g ,"\\" );
                    data=data.replace(/\"/g,"");
                    var id=$(".descimgid").get(18).value?$(".descimgid").get(18).value:"new";
                    var imgdescidpath=`${id};${data}`;
                    $($(".det").get(18)).val(imgdescidpath);
                },
                error: function (data) {
                    console.log(data);
                }
            });
            var idFile = $(this).attr("id");
            var file = document.getElementById(idFile);
            var imgContainer = $(this).parents(".z_photo"); //存放图片的父亲元素
            var fileList = file.files; //获取的图片文件
            var input = $(this).parent();//文本框的父亲元素
            var imgArr = [];
            //遍历得到的图片文件
            var numUp = imgContainer.find(".up-section").length;
            var totalNum = numUp + fileList.length;  //总的数量
            if(fileList.length > 1 || totalNum > 1 ){
                alert("上传图片数目不可以超过1个，请重新选择");  //一次选择上传超过1个 或者是已经上传和这次上传的到的总数也不可以超过5个
            }
            else if(numUp < 1){
                fileList = validateUp(fileList);
                for(var i = 0;i<fileList.length;i++){
                    var imgUrl = window.URL.createObjectURL(fileList[i]);
                    var newimg=new Image();
                    $(newimg).attr("src",imgUrl);
                    newimg.onload=function (){
                        console.log(newimg);
                        console.log(newimg.width,newimg.height);
                        if(newimg.width>800 ){
                            iosOverlay({
                                text: "图片太宽了",
                                duration: 2e3,
                                icon: "../../images/cross.png"
                            });
                        }else if(newimg.width<700){
                            iosOverlay({
                                text: "图片太窄了",
                                duration: 2e3,
                                icon: "../../images/cross.png"
                            });
                        }
                    };
                    imgArr.push(imgUrl);
                    var $section = $("<section class='up-section fl loading'>");
                    imgContainer.prepend($section);
                    var $span = $("<span class='up-span'>");
                    $span.appendTo($section);
                    var $img0 = $("<img class='close-upimg'>").on("click",function(event){
                        event.preventDefault();
                        event.stopPropagation();
                        $(".works-mask").show();
                        delParent = $(this).parent();
                    });
                    $img0.attr("src","/images/delete_tu.png").appendTo($section);
                    var $img = $("<img class='up-img up-opcity'>");
                    $img.attr("src",imgArr[i]);
                    $img.appendTo($section);
                }
            }
            setTimeout(function(){
                $(".up-section").removeClass("loading");
                $(".up-img").removeClass("up-opcity");
            },450);
            numUp = imgContainer.find(".up-section").length;
            if(numUp >= 1){
                $(this).parent().hide();
            }
        });
        $(document).on("change","#shi20",function () {
            var fileval=this.files[0];
            var formData= new FormData();
            formData.append("image",fileval);
            console.log(formData);
            if(!$(this).prop("oldimg")){
                $(this).prop("oldimg",$(".desc20").val());
                console.log($(this).prop("oldimg"))
            }
            var thisimg=this;
            $.ajax({
                url: "{:url('/admin/goods/pictureHandle')}",
                type: "post",
                data: formData,
                contentType: false,
                processData: false,
                mimeType: "multipart/form-data",
                success: function (data) {
                    data= data.replace(/\\\\/g ,"\\" );
                    data=data.replace(/\"/g,"");
                    var id=$(".descimgid").get(19).value?$(".descimgid").get(19).value:"new";
                    var imgdescidpath=`${id};${data}`;
                    $($(".det").get(19)).val(imgdescidpath);
                },
                error: function (data) {
                    console.log(data);
                }
            });
            var idFile = $(this).attr("id");
            var file = document.getElementById(idFile);
            var imgContainer = $(this).parents(".z_photo"); //存放图片的父亲元素
            var fileList = file.files; //获取的图片文件
            var input = $(this).parent();//文本框的父亲元素
            var imgArr = [];
            //遍历得到的图片文件
            var numUp = imgContainer.find(".up-section").length;
            var totalNum = numUp + fileList.length;  //总的数量
            if(fileList.length > 1 || totalNum > 1 ){
                alert("上传图片数目不可以超过1个，请重新选择");  //一次选择上传超过1个 或者是已经上传和这次上传的到的总数也不可以超过5个
            }
            else if(numUp < 1){
                fileList = validateUp(fileList);
                for(var i = 0;i<fileList.length;i++){
                    var imgUrl = window.URL.createObjectURL(fileList[i]);
                    var newimg=new Image();
                    $(newimg).attr("src",imgUrl);
                    newimg.onload=function (){
                        console.log(newimg);
                        console.log(newimg.width,newimg.height);
                        if(newimg.width>800 ){
                            iosOverlay({
                                text: "图片太宽了",
                                duration: 2e3,
                                icon: "../../images/cross.png"
                            });
                        }else if(newimg.width<700){
                            iosOverlay({
                                text: "图片太窄了",
                                duration: 2e3,
                                icon: "../../images/cross.png"
                            });
                        }
                    };
                    imgArr.push(imgUrl);
                    var $section = $("<section class='up-section fl loading'>");
                    imgContainer.prepend($section);
                    var $span = $("<span class='up-span'>");
                    $span.appendTo($section);
                    var $img0 = $("<img class='close-upimg'>").on("click",function(event){
                        event.preventDefault();
                        event.stopPropagation();
                        $(".works-mask").show();
                        delParent = $(this).parent();
                    });
                    $img0.attr("src","/images/delete_tu.png").appendTo($section);
                    var $img = $("<img class='up-img up-opcity'>");
                    $img.attr("src",imgArr[i]);
                    $img.appendTo($section);
                }
            }
            setTimeout(function(){
                $(".up-section").removeClass("loading");
                $(".up-img").removeClass("up-opcity");
            },450);
            numUp = imgContainer.find(".up-section").length;
            if(numUp >= 1){
                $(this).parent().hide();
            }
        });
        imgele=null;
        imgid=null;
        $(".z_photo").delegate(".close-upimg","click",function(){
            $(".works-mask").show();
            delParent = $(this).parent();
            imgele=delParent.parent().parent().find(".det");
            imgid=delParent.parent().parent().find(".descimgid").val();
            console.log(imgele);
         /*   $(".wsdel-ok").click(function(){
                $(".works-mask").hide();
                var imgval=imgid?`${imgid};del`:"";
                $(imgele).val(imgval);
                console.log(imgval)
                var numUp = delParent.siblings().length;
                if(numUp < 9){
                    delParent.parent().find(".z_file").show();
                }
                delParent.remove();
            });*/
        });

         $(".wsdel-ok").click(function(){
             $(".works-mask").hide();
             var imgval=imgid?`${imgid};del`:"";
             imgele?$(imgele).val(imgval):null;
             console.log(imgval)
             var numUp = delParent.siblings().length;
             if(numUp < 9){
             delParent.parent().find(".z_file").show();
             }
             delParent.remove();
         });

        $(".wsdel-no").click(function(){
            $(".works-mask").hide();
        });
        function validateUp(files){
            var arrFiles = [];//替换的文件数组
            for(var i = 0, file; file = files[i]; i++){
                //获取文件上传的后缀名
                var newStr = file.name.split("").reverse().join("");
                if(newStr.split(".")[0] != null){
                    var type = newStr.split(".")[0].split("").reverse().join("");
                    // console.log(type+"===type===");
                    if(jQuery.inArray(type, defaults.fileType) > -1){
                        // 类型符合，可以上传
                        // console.log(file)
                        if (file.size >= defaults.fileSize) {
                            // alert('您这个"'+ file.name +'"文件大小过大');
                            method.msg_layer({
                                title: "提示信息",
                                content:'您这个"'+ file.name +'"文件大小过大',
                                btn: ["确定",""]
                            });
                        }
                        else {
                            // 在这里需要判断当前所有文件中
                            arrFiles.push(file);
                        }
                    }else{
                        //  alert('您这个"'+ file.name +'"上传类型不符合');
                        method.msg_layer({
                            title: "提示信息",
                            content:'您这个"'+ file.name +'"上传类型不符合',
                            btn: ["确定",""]
                        });
                    }
                }else{
                    //  alert('您这个"'+ file.name +'"没有类型, 无法识别');
                    method.msg_layer({
                        title: "提示信息",
                        content:'您这个"'+ file.name +'"没有类型, 无法识别',
                        btn: ["确定",""]
                    });
                }
            }
            return arrFiles;
        }
    });

    $("#submit").click(
            function () {
                console.log($("input[name=image]").val());
                /*    if($("#goodclass").html()=="" ){
                 alert("请选择商品分类！");
                 return false
                 }else if(!nameok){
                 iosOverlay({
                 text: `商品名太长了！`,
                 duration: 2e3,
                 icon: "../../images/cross.png"
                 });
                 return false
                 }*/
            }
    );
</script>
</body>
</html>